Exemple #1
0
    private void MoveExistingTower(GrassTile tile)
    {
        towers[index].ParentTile.RemoveTowerFromTile();
        // towers[index].ParentTile.isTowerPlaced = false;                     //Reset isTowerPlaced for old Position
        towers[index].transform.position = tile.transform.position + yOffset;
        towers[index].ParentTile         = tile;
        tile.SetTowerToTile(towers[index]);

        OnTowerPlaced?.Invoke(towers[index]);
    }
Exemple #2
0
    private void InstantiateNewTower(GrassTile tile)
    {
        Tower tower = Instantiate(towerPrefab, tile.transform.position + yOffset, Quaternion.identity);

        towers[index] = tower;
        tower.transform.SetParent(gameObject.transform);
        tower.gameObject.name    = "Tower " + index;
        towers[index].ParentTile = tile;
        tile.SetTowerToTile(tower);

        OnTowerPlaced?.Invoke(tower);
    }
Exemple #3
0
        private void Update()
        {
            if (IsPlacingTower)
            {
                _currentTowerGO.transform.position = InputController.TowerPlacementPosition;
            }

            if (TryPlaceTower)
            {
                OnTowerPlaced?.Invoke(_curTowerController);
                TowerPlacementState = TowerPlacementState.NotPlacingTower;
                _gameController.DecrementMoney(_curTowerController.TowerProperties.Cost);
                _curTowerController = null;
                _currentTowerGO     = null;
            }
        }