Esempio n. 1
0
 public GameObject(GameTable gameTable, GameEndingCondition gameEndingCondition)
 {
     this.gameTable           = gameTable;
     this.gameEndingCondition = gameEndingCondition;
     this.playedRoundCount    = 0;
     ScoreBoard.ResetScores();
 }
Esempio n. 2
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;
        }
Esempio n. 3
0
        public override void InitializeGame()
        {
            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] = game;
                modeParams.CopyTo(roundCountConditionParams, 1);
                gameEndingCondition = new RoundCountCondition(modeParams);
                break;
            }

            //      HANDLE PLAYER ACTIONS   //

            Deck mainDeck = new Deck();

            List <Card>[] splittedCards = mainDeck.Deal();

            for (int i = 0; i < 4; i++)
            {
                Deck newPlayerDeck = new Deck(splittedCards[i]);
                seats[i].SetPlayersDeck(newPlayerDeck);
            }

            game = new ConsoleGame(this, gameEndingCondition);
            game.Commence();
            state = GameState.PLAYING;
        }
Esempio n. 4
0
        public virtual void InitializeGame()
        {
            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] = game;
                modeParams.CopyTo(roundCountConditionParams, 1);
                gameEndingCondition = new RoundCountCondition(modeParams);
                break;
            }

            DealCards();
            UpdatePlayerDeckValues();

            game = new GameObject(this, gameEndingCondition);
            game.Commence();
            state = GameState.PLAYING;
        }
Esempio n. 5
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();
                }
            }
        }
Esempio n. 6
0
 public ConsoleGame(GameTable gameTable, GameEndingCondition gameEndingCondition)
     : base(gameTable, gameEndingCondition)
 {
     gameEnded = false;
 }
Esempio n. 7
0
 public UnityGame(GameTable gameTable, GameEndingCondition gameEndingCondition)
     : base(gameTable, gameEndingCondition)
 {
 }