Esempio n. 1
0
    private void InstantiateTower(PlaceTowers baseTowerPlacement)
    {
        var newTower = Instantiate(towerPrefab, baseTowerPlacement.transform.position, Quaternion.identity);

        newTower.transform.parent     = towerParent;
        newTower.towerBase            = baseTowerPlacement;
        baseTowerPlacement.isPlacable = false;
        placedTowers.Enqueue(newTower);
    }
Esempio n. 2
0
    private void MoveExistingTower(PlaceTowers newTowerBasePlacement)
    {
        var oldTower = placedTowers.Dequeue();

        oldTower.towerBase.isPlacable    = true;
        newTowerBasePlacement.isPlacable = false;
        oldTower.towerBase          = newTowerBasePlacement;
        oldTower.transform.position = newTowerBasePlacement.transform.position;
        placedTowers.Enqueue(oldTower);
    }
Esempio n. 3
0
 public void AddTower(PlaceTowers baseTowerPlacement)
 {
     towerCount = placedTowers.Count;
     if (towerCount > towerLimit - 1)
     {
         MoveExistingTower(baseTowerPlacement);
     }
     else
     {
         InstantiateTower(baseTowerPlacement);
     }
 }