Example #1
0
 public void createCircle(SelectableObject selectableObject)         //cirlce prefabs should be set to 0.1 and 0.2 higher in y for projection to work
 {
     if (selectableObject.selectionCircle == null)                   //only creates if they haven't got one, this stops us setting all units many times
     {
         if (selectableObject.gameObject.GetComponent <Buildings>()) //if selected is a building, use bigger selection prefab
         {
             selectableObject.selectionCircle = Instantiate(selectionCircleBiggerPrefab);
             selectableObject.selectionCircle.transform.SetParent(selectableObject.transform, false);
         }
         else                                                                                      //its a unit or battalion, make sure to call select on the battalion and give the units circles in the battalion
         {
             Battalion battalion = selectableObject.gameObject.GetComponentInParent <Battalion>(); //get battalion
             battalion.Select(selectionCirclePrefab);
         }
     }
 }