Exemple #1
0
        private ConstructionView.DisplayUIComp FormTowerUIComp(string label, string id, Sprite sprite, System.Action clickCallback)
        {
            ConstructionView.DisplayUIComp uiComp = new ConstructionView.DisplayUIComp();

            uiComp.label = label;

            uiComp._id = id;

            uiComp.sprite = sprite;

            uiComp.ClickEvent = () =>
            {
                clickCallback();
            };

            return(uiComp);
        }
Exemple #2
0
        private ConstructionView.DisplayUIComp[] GetInitialTowerPlacement()
        {
            List <TowerStats> firstLevelTowers = _statHolder.FindObjectByType <TowerStats>();

            firstLevelTowers = firstLevelTowers.FindAll(x => x.level == 1);

            int towerLength = firstLevelTowers.Count;

            ConstructionView.DisplayUIComp[] uiCompArray = new ConstructionView.DisplayUIComp[towerLength];

            for (int i = 0; i < towerLength; i++)
            {
                int index = i;
                ConstructionView.DisplayUIComp uiComp = FormTowerUIComp("$" + firstLevelTowers[i].cost, firstLevelTowers[i].id, firstLevelTowers[i].sprite,
                                                                        () =>
                {
                    SelectTowerToBuild(firstLevelTowers[index].id);
                });

                uiCompArray[i] = uiComp;
            }

            return(uiCompArray);
        }