Esempio n. 1
0
    public void CmdSignalPlayerReady()
    {
        int index = networkManager.GetConnectedClients().IndexOf(connectionToClient);

        player.SetPlayerReady(index);

        // Start game
        if (player.AllPlayersReady())
        {
            // Spawn tables
            CmdSpawnTables();

            // Spawn initial card
            ColorCard cc;
            do
            {
                cc = ColorCardStack.DrawCard();
                CmdSpawnCardOnGameboard(cc);
            } while (cc.type != ColorCard.Type.STANDARD);

            // Init card count for each player
            Player.playerCardsCount = new int[] { 7, 7, 7, 7 };
            RpcSetPlayerCardsCount(Player.playerCardsCount); // Sync with clients

            // Start game
            player.SetCurrentPlayerIndex(0); // Server starts always first
            player.SetTurn(true, 0);
            RpcPlayerIndexChanged(0);
        }
    }