Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        int playerType;

        board = GetComponent <Board>();
        if (team == Team.Blue)
        {
            activeTurnState = BoardState.TurnState.Blue;
            targetTurnState = BoardState.TurnState.BlueVictory;
            playerType      = PlayerPrefs.GetInt(Settings.bluePlayerKey, 0);
            budget          = PlayerPrefs.GetInt(Settings.bluePlayerBudgetKey, 5);
        }
        else
        {
            activeTurnState = BoardState.TurnState.Red;
            targetTurnState = BoardState.TurnState.RedVictory;
            playerType      = PlayerPrefs.GetInt(Settings.redPlayerKey, 1);
            budget          = PlayerPrefs.GetInt(Settings.redPlayerBudgetKey, 5);
        }
        switch (playerType)
        {
        case 0:
            type = Type.Human;
            break;

        case 1:
            type = Type.SimpleAI;
            break;

        case 2:
            type = Type.MCTS;
            break;
        }
    }
Пример #2
0
    private void UpdatePossibleTurns()
    {
        if (boardState.turnState == previousTurnState)
        {
            return;
        }
        previousTurnState = boardState.turnState;

        for (int i = 0; i < possibleTurnsIndicators.Length; i++)
        {
            possibleTurnsIndicators[i].SetActive(false);
        }
        if (boardState.validTurns.Count == 0)
        {
            ban.SetActive(false);
            return;
        }
        else
        {
            arrow.SetActive(true);
        }
        for (int i = 0; i < boardState.validTurns.Count; i++)
        {
            possibleTurnsIndicators[boardState.validTurns[i]].SetActive(true);
        }
        selectedTurn = boardState.turnState == BoardState.TurnState.Blue ? boardState.validTurns.Count - 1 : 0;
        arrow.transform.localPosition = new Vector3(0.75f * boardState.validTurns[selectedTurn], -0.65f);
        if (boardState.moveBanned)
        {
            ban.SetActive(true);
            possibleTurnsIndicators[boardState.lastTurn].SetActive(true);
            ban.transform.position = possibleTurnsIndicators[boardState.lastTurn].transform.position;
        }
        else
        {
            ban.SetActive(false);
        }

        readyForInput = true;
    }