public void unit_selected(bool value) { UnitSelected = value; if (UnitSelected) { set_selected_loc(); if (Windows.Map.Window_Prep_Organize.SWAP) { int index = this.index + 1; if (index >= Global.battalion.actors.Count) { index = Math.Max(0, index - 2); } this.index = index; } refresh_scroll(false); update_cursor(); UnitCursor.move_to_target_loc(); } }
//Projects spawn-markers (Handles) with selected settings public static void ShowSpawnMarkers(SquadTrigger squadTrigger) { foreach (Squad squad in squadTrigger.Squads) { if (squad.UnitPositions != null) { for (int count = 0; count < squad.UnitPositions.Length; count++) { if (count == 0) { Handles.color = Color.red; //Spawn button marker at location of squad if (Handles.Button(squad.UnitPositions[count], Quaternion.identity, 0.25f, 0.25f, Handles.DotCap)) { //Make squad active GameObject in Hierarchy Selection.activeGameObject = squad.gameObject; } } else { Handles.color = Color.yellow; //Spawn simple marker at target Vector if (Handles.Button(squad.UnitPositions[count], Quaternion.identity, 0.25f, 0.25f, Handles.DotCap)) { UnitCursor cursor = squadTrigger.SquadManager.UnitCursor.GetComponent <UnitCursor>(); cursor.SetUnit(count, squad); Selection.activeGameObject = cursor.gameObject; } } } } } }
public override void Awake() { base.Awake(); unitCursor = Instantiate(unitCursor) as UnitCursor; }
void OnEnable() { unitCursor = (UnitCursor)target; unitCursor.SetCursorPosition(); }