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); }
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); } }