예제 #1
0
파일: Shop.cs 프로젝트: ElasticSea/Tiny-TD
        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);
        }
예제 #2
0
파일: Shop.cs 프로젝트: ElasticSea/Tiny-TD
        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;
        }