Example #1
0
        /// <summary>
        /// Room Owner will send a Callback to this method after receiving feedback from all the players
        /// </summary>
        public void PlayersReadyCallback()
        {
            if (LobbyPlayerStats.RoomData.getRoomOwner() == MultiplayerManager.StaticPlayer.GetInternalPlayer().PlayerName)
            {
                MultiplayerManager.SendBytes(ByteHelper.GetBytes("START"));
            }
            GameEndingCondition gameEndingCondition = null;

            switch (MultiplayerManager.CurrentEndCondition)
            {
            case GameMode.TargetScore:
                gameEndingCondition = new TargetScoreCondition(new object[1] {
                    MultiplayerManager.CurrentEndConditionGoal
                });
                break;

            case GameMode.RoundCount:
                object[] roundCountConditionParams = new object[2];
                roundCountConditionParams[0] = this;
                roundCountConditionParams[1] = MultiplayerManager.CurrentEndConditionGoal;
                gameEndingCondition          = new RoundCountCondition(roundCountConditionParams);
                break;
            }

            game = new UnityGame(this, gameEndingCondition);
            game.Commence(UITable.MultiplayerGamers.GetPlayerByPlayerName(LobbyPlayerStats.RoomData.getRoomOwner()).GetPlayersSeat());
            state = GameState.PLAYING;
        }
Example #2
0
        public override void InitializeGame()
        {
            if (Properties.ActiveGameType == GameType.SinglePlayer)
            {
                GameEndingCondition gameEndingCondition = null;
                switch (gameMode)
                {
                case GameMode.TargetScore:
                    gameEndingCondition = new TargetScoreCondition(modeParams);
                    break;

                case GameMode.RoundCount:
                    object[] roundCountConditionParams = new object[modeParams.Length + 1];
                    roundCountConditionParams[0] = this;
                    modeParams.CopyTo(roundCountConditionParams, 1);
                    gameEndingCondition = new RoundCountCondition(modeParams);
                    break;
                }

                DealCards();
                UpdatePlayerDeckValues();

                game = new UnityGame(this, gameEndingCondition);
                game.Commence();
                state = GameState.PLAYING;
            }
            else
            {
                if (LobbyPlayerStats.RoomData.getRoomOwner() == MultiplayerManager.StaticPlayer.GetInternalPlayer().PlayerName)
                {
                    MultiplayerManager.DealCallback = 0;
                    DealCards();
                    UpdatePlayerDeckValues();
                }
            }
        }