Exemple #1
0
    public void SpawnUnit()
    {
        Vector3 position = cellSelection.GetSelectedCell().transform.position;
        Unit    newUnit  = unitFactory.SpawnUnit(selectedUnit.GetUnitInfo()[1].ToString(), position);

        if (PlayerControler.GetInstance().FirstPlayerTurn())
        {
            unitsList.AddToLeft(newUnit);
        }
        else
        {
            unitsList.AddToRight(newUnit);
        }
        unitSelection.SelectUnit(newUnit);

        PlayerControler.GetInstance().SpendEnergy(selectedUnit.GetPrice());
        GameEvents.GetInstance().UnitSpawned();
        Close();
    }