示例#1
0
        public void AddBuildButtonForTower(Tower tower)
        {
            TowerBuildButton button =
                Instantiate(Resources.Load <TowerBuildButton>("Prefabs/UI/TowerBuildButton"));

            button.Tower = tower;
            button.SetIcon(button.Tower.Icon);
            button.transform.SetParent(_towerButtonContainer.transform);

            button.PriceTag.text = "" + tower.GoldCost;

            _towerButtons.Add(button);
        }
示例#2
0
        public void RemoveBuildButton(TowerBuildButton button, bool placed)
        {
            if (button == null)
            {
                return;
            }

            _towerButtons.Remove(button);

            Destroy(button.gameObject);

            if (!placed)
            {
                button.Tower.Remove();
                Destroy(button.Tower.gameObject);
            }
        }