예제 #1
0
    public void PressEndTurnButton()
    {
        if (currentPlayer == 1)
        {
            currentPlayer = 2;
        }
        else
        {
            currentPlayer = 1;
        }

        //For every character in Player 1, set can move and can attack.
        foreach (GameObject unit in player1Units)
        {
            unit.GetComponent <Character>().SetCanMove(true);
            unit.GetComponent <Character>().SetCanAttack(true);
        }
        //For every character in Player 2/Enemy, set can move and can attack.
        foreach (GameObject unit in player2Units)
        {
            unit.GetComponent <Character>().SetCanMove(true);
            unit.GetComponent <Character>().SetCanAttack(true);
        }
        //Reset selection state.
        if (TileBehavior.GetSelectionState() != null)
        {
            TileBehavior.selectedTile.GetComponent <TileBehavior>().SelectionStateToNull();
        }
        AddCTPObjectivePoints();
    }
예제 #2
0
    public void PressEndTurnButton()
    {
        if (currentPlayer == 1)
        {
            currentPlayer  = 2;
            player2Energy += 10;
            endButton.GetComponent <Image>().color = new Color(0f, 0f, 1f, 1f);
        }
        else
        {
            currentPlayer  = 1;
            player1Energy += 10;
            turnCounter++;
            endButton.GetComponent <Image>().color = new Color(1f, 0f, 0f, 1f);
            turnText.text = $"Turn {turnCounter.ToString()}";
        }
        UpdateUI();

        //For every character in Player 1, set can move and can attack.
        foreach (GameObject unit in player1Units)
        {
            unit.GetComponent <Character>().SetCanMove(true);
            unit.GetComponent <Character>().SetCanAttack(true);
        }
        //For every character in Player 2/Enemy, set can move and can attack.
        foreach (GameObject unit in player2Units)
        {
            unit.GetComponent <Character>().SetCanMove(true);
            unit.GetComponent <Character>().SetCanAttack(true);
        }
        //Reset selection state.
        if (TileBehavior.GetSelectionState() != null)
        {
            TileBehavior.selectedTile.GetComponent <TileBehavior>().SelectionStateToNull();
        }
        AddCTPObjectivePoints();
    }