Пример #1
0
    /// <summary>
    /// Converts GamePHase enum
    /// </summary>
    /// <param name="p_GamePhase">P game phase.</param>
    private string convert(Enums.GamePhase p_GamePhase)
    {
        string rString = "";

        switch (p_GamePhase)
        {
        case Enums.GamePhase.SETUP_ONE:
            rString = "Setup One";
            break;

        case Enums.GamePhase.SETUP_TWO:
            rString = "Setup Two";
            break;

        case Enums.GamePhase.PHASE_ONE:
            rString = "Phase One";
            break;

        case Enums.GamePhase.PHASE_TWO:
            rString = "Phase Two";
            break;

        default:
            break;
        }

        return(rString);
    }
Пример #2
0
    void Start()
    {
        if (isClient)
        {
            Debug.Log("Client game manager start");
        }

        players                = new List <Player>();
        gamePhase              = Enums.GamePhase.SETUP_ONE;
        pointsToWin            = 16;
        firstDie               = 0;
        secondDie              = 0;
        longestRouteLength     = 0;
        merchantController     = -1;
        longestRouteController = -1;

        metropolises = new Dictionary <DevChartType, Vertex>();
        metropolises.Add(Enums.DevChartType.POLITICS, null);
        metropolises.Add(Enums.DevChartType.TRADE, null);
        metropolises.Add(Enums.DevChartType.SCIENCE, null);

        barbarianHasAttacked = false;
        graph = new Graph();

        Init();
    }
Пример #3
0
    // Resolve a dice roll
    private void resolveDice()
    {
        // Check if a seven was rolled
        if (firstDie + secondDie == 7)
        {
            resolveSeven(0);
        }
        else
        {
            distribute();
            gamePhase = Enums.GamePhase.PHASE_TWO;
        }

        //Barbarian

        //Event Die
    }
Пример #4
0
    // Move to next turn based on game phase
    public void SetPlayerTurn(bool server)
    {
        // Assign client authority
        assignAuthority(server);

        // Increment gamephase
        if (this.gamePhase == Enums.GamePhase.SETUP_ONE)
        {
            playerTurn++;
            if (this.playerTurn >= players.Count)
            {
                playerTurn = players.Count - 1;
                gamePhase  = Enums.GamePhase.SETUP_TWO;
            }
        }
        else if (this.gamePhase == Enums.GamePhase.SETUP_TWO)
        {
            playerTurn--;
            if (this.playerTurn < 0)
            {
                playerTurn = 0;
                gamePhase  = Enums.GamePhase.PHASE_ONE;
            }
        }
        else
        {
            playerTurn++;
            if (this.playerTurn >= players.Count)
            {
                playerTurn = 0;
            }
            gamePhase = Enums.GamePhase.PHASE_ONE;
        }

        removeAuthority(server);
    }