Example #1
0
 void UpdateBuildableStatus()
 {
     for (int i = 0; i < buildButtons.Count; i++)
     {
         buildButtons[i].button.interactable = TowerManager.CheckTowerCounterLimit(buildableList[i].prefabID, buildableList[i].limitInScene);
     }
 }
Example #2
0
        public SelectInfo(BuildPlatform p, int ID)
        {
            platform = p; nodeID = ID;

            if (AvailableForBuild())
            {
                buildableList = new List <UnitTower>(TowerManager.GetBuildableList());

                //for limiting amount of tower in the scene according to prefabID
                for (int i = 0; i < buildableList.Count; i++)
                {
                    if (TowerManager.CheckTowerCounterLimit(buildableList[i].prefabID, buildableList[i].limitInScene))
                    {
                        continue;
                    }
                    buildableList.RemoveAt(i); i -= 1;
                }

                for (int i = 0; i < platform.unavailablePrefabIDList.Count; i++)
                {
                    for (int n = 0; n < buildableList.Count; n++)
                    {
                        if (buildableList[n].prefabID == platform.unavailablePrefabIDList[i])
                        {
                            buildableList.RemoveAt(n);
                            break;
                        }
                    }
                }

                if (PathBlocked())                      //can only build mine
                {
                    for (int i = 0; i < buildableList.Count; i++)
                    {
                        if (!buildableList[i].IsMine())
                        {
                            buildableList.RemoveAt(i);      i -= 1;
                        }
                    }
                }
            }
        }