private void OnJoinGame(Player player, JToken data) { QuestMatch game = this.gameWithId((int)data["game_id"]); player.Behaviour = new HumanPlayer(); game.AddPlayer(player); this.matches.Add(player, game); this.UpdatePlayers(this.matches[player]); }
private void OnCreateGame(Player player, JToken data) { QuestMatch match = ScenarioCreator.EmptyGame(this); int scenario = (int)data["scenario"]; if (scenario == 1) { match = ScenarioCreator.Scenario1(this); } if (scenario == 2) { match = ScenarioCreator.Scenario2(this); } player.Behaviour = new HumanPlayer(); match.AddPlayer(player); this.matches.Add(player, match); this.UpdatePlayers(this.matches[player]); }
private void OnAddAI(Player player, JToken data) { int strat = (int)data["strategy"]; QuestMatch match = this.matches[player]; Player aiPlayer = new Player("AI Player " + match.Players.Count); if (strat == 1) { aiPlayer.Behaviour = new Strategy1(); } if (strat == 2) { aiPlayer.Behaviour = new Strategy2(); } if (strat == 3) { aiPlayer.Behaviour = new Strategy3(); } match.AddPlayer(aiPlayer); this.UpdatePlayers(this.matches[player]); }