Exemplo n.º 1
0
        private Tower BuiildTower(TowerUpgrade upgrade, Vector3 position)
        {
            print(upgrade.tower);
            var tower = Instantiate(upgrade.tower);

            FindObjectOfType <Player>().Money -= upgrade.price;
            tower.transform.position           = position;
            selectedTower = tower;
            ShowUpgrades(selectedTower.Upgrades);
            return(tower);
        }
Exemplo n.º 2
0
        private void ShowTower(TowerUpgrade upgrade)
        {
            if (selectedTower)
            {
                var transformPosition = selectedTower.transform.position;
                DestroyImmediate(selectedTower.gameObject);
                var tower = BuiildTower(upgrade, transformPosition);
                return;
            }

            if (shadow)
            {
                DestroyImmediate(shadow.gameObject);
            }
            shadow       = new GameObject("Shadow Tower Place").AddComponent <ShadowTowerPlacer>();
            shadow.Tower = upgrade.tower;
            this.upgrade = upgrade;
        }