예제 #1
0
 void SetUI(Types.ConstructionTypes type, bool b)
 {
     if (Buttons.ContainsKey(type))
     {
         if (Buttons[type] != null)
         {
             Buttons[type].interactable = b;
         }
     }
 }
예제 #2
0
 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);
 }
예제 #3
0
 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);
 }
예제 #4
0
 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);
 }
예제 #5
0
 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");
         }
     }
 }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }