private void RemoveEchelon(EchelonBehavior echelon) { if (echelon != null) { allEchelons.Remove(echelon); if (echelon.GetFaction() != Faction.Blue) { enemies.Remove(echelon); } else { if (echelon as ParachuteBehavior != null) { retreatedEchelons.Enqueue(echelon.GetID()); parachuteEchelons.Remove(echelon as ParachuteBehavior); planner.RemoveEchelon(); } else if (echelon as HOCBehavior != null) { retreatedHOCs.Enqueue(echelon.GetID()); HOCs.Remove(echelon as HOCBehavior); planner.RemoveHOC(); } else { if (regularEchelons.Contains(echelon)) { retreatedEchelons.Enqueue(echelon.GetID()); regularEchelons.Remove(echelon); planner.RemoveEchelon(); } else { NPCs.Remove(echelon); } } } Destroy(echelon.gameObject); } }
public void SelectEchelon(EchelonBehavior echelon) { if (!MoveEcheToNode(echelon.GetNode())) { DeselectEchelon(); selectedEchelon = echelon; selectedEchelon.GetComponent <Image>().color = Color.yellow; SelectedEchelonDescription.text = "Echelon: " + echelon.GetID() + "\nFaction: " + echelon.GetFaction(); if (selectedEchelon.GetFaction() == Faction.Blue && !NPCs.Contains(selectedEchelon)) { SelectedEchelonDescription.text += "\nSupply: " + echelon.GetSupply().x + " / " + echelon.GetSupply().y; } if (selectedEchelon.GetName().Length > 0) { SelectedEchelonDescription.text = SelectedEchelonDescription.text.Insert(0, "Name: " + selectedEchelon.GetName() + "\n"); } ParachuteBehavior para = echelon as ParachuteBehavior; if (para != null) { SelectedEchelonDescription.text += "\nParachute CD: " + para.GetCooldown(); } else { HOCBehavior HOC = echelon as HOCBehavior; if (HOC != null) { SelectedEchelonDescription.text += "\nRange: " + HOC.GetRange(); nodesInSelectedHOCRange = HOC.GetAllNodesInRange(); HighlightNodesInHOCRange(); } } } }