private const int aiDelay = 250; // The time for an AI player play public BoardViewModel(GameManager gameManager) { if (gameManager == null) { throw new ArgumentNullException(); } this.gameManager = gameManager; gameManager.GameChanged += OnGameCanged; player1 = new HumanPlayerViewModel(gameManager, 0); player2 = new PlayerViewModel(gameManager, 1); player3 = new PlayerViewModel(gameManager, 2); player4 = new PlayerViewModel(gameManager, 3); aiPlayer = new SimpleAIPlayer(); Update(); }
private void UpdateStatusMessage() { Rules rules = gameManager.Rules; Game game = gameManager.Game; string msg = ""; if (game.Phase == HeartsPhase.PassCards) { msg = "Select 3 cards to pass and then press the button."; } else if (game.Phase == HeartsPhase.Tricks && game.CurrentPlayer != -1) { PlayerViewModel curPlayer = Board.GetPlayerByIndex(game.CurrentPlayer); msg = "Current player: " + curPlayer.Name; if (curPlayer is HumanPlayerViewModel) { msg += " - Select a card to play."; } } StatusMessage = msg; }