public static void SelectUnit(GameObject unit) { if (unit.tag == "planet") { if (player == null) { player = new NationState(); } //activate build menu, research menu if (nationMenu == null) { nationMenu = GameObject.Find("PlayerMenu"); } nationMenu.SetActive(true); //show country menu (country shape, launch spots, available funds) } switch (selectState) { case SelectStates.SELECT_SOURCE: selectedSource = unit; selectionIcon.transform.parent = unit.transform; selectionIcon.transform.localPosition = Vector3.zero; selectionIcon.SetActive(true); uxState = UXStates.IDLE; Debug.Log("Selected source"); break; case SelectStates.SELECT_TARGET: //can't select same target as source if (selectedSource == unit) { Debug.Log("Can't select same target as source"); break; } Debug.Log("Selected target"); selectedTarget = unit; targetIcon.transform.parent = unit.transform; targetIcon.transform.localPosition = Vector3.zero; targetIcon.SetActive(true); //TODO this shouldn't happen until menu state change (cancel/escape from current mode) //TODO reset porkchop plot and intercept line on tgt or src change break; } }
public static void ClearSource() { selectedSource = null; uxState = UXStates.HIDDEN; }