public void CreateNewStartingHand() { var tileManager = TileManager.GetInstance(); var pileCount = tileManager.GetPileCount(); if (pileCount < _startingHandSize) { throw new IndexOutOfRangeException ("The pile count is smaller than the starting hand count"); } _currentHand.Clear(); _currentHand = tileManager.SelectRandomTileSetFromPile(_startingHandSize); }
public async Task Initialize(GameBoardNavigationArgs args) { _gameConnectionType = args.GameConnectionType; _gameMode = args.GameMode; _tileManager = TileManager.GetInstance(); await _tileManager.InitializeForNewGame(); _botManager = BotManager.GetInstance(); _gameBoard = GameBoard.GetInstance(); _gameBoard.ClearBoard(); _dictionary = Dictionary.GetInstance(); await _dictionary.PopulateDictionary(); InitializeGameClock(); _humanPlayer = new HumanPlayer(); _localPlayers.Clear(); _localPlayers.Add(_humanPlayer); _botManager.ClearBotList(); for (int i = 0; i < args.BotCount; i++) { _botManager.CreateBot(5); } foreach (IRobot bot in _botManager.BotList) { _localPlayers.Add(bot); } foreach (IPlayer player in _localPlayers) { player.InitializeForGame(); } OnInitializeComplete(); }