void SetUI(Types.ConstructionTypes type, bool b) { if (Buttons.ContainsKey(type)) { if (Buttons[type] != null) { Buttons[type].interactable = b; } } }
bool IHaveA(Types.ConstructionTypes type) { for (int i = 0; i < MyTeam.transform.childCount; i++) { Selectable s = MyTeam.transform.GetChild(i).GetComponent <Selectable>(); if (s.Data.Type == type) { return(true); } } return(false); }
public float CostOf(Types.ConstructionTypes t) { Selectable[] items = transform.GetComponentsInChildren <Selectable>(); foreach (Selectable s in items) { if (s.Data.Type == t) { return(s.Data.Cost); } } return(100); }
public GameObject GetProtoByType(Types.ConstructionTypes type) { foreach (GameObject go in Prototypes) { Selectable s = go.GetComponent <Selectable>(); if ((s != null) && (s.Data.Type == type)) { return(go); } } return(null); }
public void SelectByType(Types.ConstructionTypes type, bool Add = false) { if (Add == false) { DeselectAll(); } foreach (Selectable t in MyArmy.GetComponentsInChildren <Selectable>()) { if (t.Data.Type == type) { t.SendMessage("Select"); } } }
public bool CheckBuild(Types.ConstructionTypes type) { Team team = GetComponent <Team>(); if ((CountOf(type) > Limits[type]) && (CostOf(type) <= team.Data.Credits)) { SetUI(type, false); return(false); } SetUI(type, true); return(true); }
public int CountOf(Types.ConstructionTypes t) { Selectable[] items = transform.GetComponentsInChildren <Selectable>(); int Count = 1; foreach (Selectable s in items) { if (s.Data.Type == t) { Count++; } } return(Count); }