Unity3D Building Damage Tutorial- Part IIb - Verticle Class

Nice, so lets look at the verticle Class. Verticle.cs

Variables
sing UnityEngine; using System.Collections; using System.Collections.Generic; namespace RTS{ public class Verticle { private MeshManager OwnerManager; private VerticleState state; public int number; private List Aliases; private List Triangles; private List LinkedAliases; public Vector3 positionRelative; public Vector3 positionAbsolute;

public enum VerticleState { Standard, Burning, Destroyed}// in Enums.cs
 * OwnerManager is the MeshManager in which this object of Variable class is in. We are going to communicate with it, so this is necessary.
 * Here we have a state of this Alias. It is an enum, in form of
 * Here we have a number of Alias. It is assigned by contructor, in ManageVerticles in    MeshManager
 * I am sorry. I have named it in bad way. Well, alias here is not the same as Alias in MeshManager. Here this are verticles number from mesh.verticles witch form the Alias. In other words, this verticles have the same coordinates.
 * This is a list of triangle numbers this Alias is taking part in. The numbers of triangles corresponds to Triangles list from MeshManager
 * This List consists of numbers of Aliases linked to out Alias. In other words the Aliases it is making triangles with.
 * Easy. Position Relative is position relative to global mesh position, and position Absolute is position relative + global mesh position.

Constructor
public Verticle(MeshManager Owner ,int Xnumber, List XAliases, Vector3 XpositionRelative){ Initialise; OwnerManager = Owner; number = Xnumber; Aliases = XAliases; positionRelative = XpositionRelative; SetPositionAbsolute; } Ok, this is the constructor. It takes 4 parameters.
 * 1)  The meshmanager which owns this Alias.
 * 2)  Number of Alias in the Aliases List in meshManager
 * 3)  Numbers of variables which makes the Alias
 * 4)  Position of this verticles, and thus position of Alias

You can look how this function is called in MeshManager.cs 		foreach(var pair in TempAliases){//a Key-Value Pair Aliases.Add (new Verticle(this, i, pair.Value, pair.Key)); ManageVerticleToAliasArray(i,pair.Value); i++; } in Closer look new Verticle(this, i, pair.Value, pair.Key)

Initialise method
private void Initialise { Aliases = new List; Triangles = new List; } Nothing to talk about.

SetPositionAbsolute method
private void SetPositionAbsolute{ positionAbsolute = OwnerManager.ParentPosition; positionAbsolute = positionAbsolute + positionRelative; } Easy. Gets global mesh position, and than adds the relative Alias position to it.

So, now lets try to inflict some damage Part III - Simple Damage