コード例 #1
0
    public void CmdGetCard()
    {
        ColorCard cc = ColorCardStack.DrawCard();

        if (cc.Equals(default(ColorCard)))
        {
            // Stack is empty --> Reshuffle
            ColorCardStack.ReshuffleStack(SpawnedCards);
            cc = ColorCardStack.DrawCard();
        }

        TargetTakeCard(connectionToClient, cc);

        if (player.GetCurrentDrawCount() > 0)
        {
            player.SetCurrentDrawCount(player.GetCurrentDrawCount() - 1);
        }

        int index = networkManager.GetConnectedClients().IndexOf(connectionToClient);

        Player.playerCardsCount[index] += 1;
        player.SetCardsCount(Player.playerCardsCount);

        // Sync new card count with all clients
        RpcSetPlayerCardsCount(Player.playerCardsCount);
    }