Example #1
0
 /// <summary>
 /// Public method to instantiate ServerGameBoard singleton.
 /// </summary>
 /// <returns></returns>
 public static GameBoard GetInstance()
 {
     return _instance ?? (_instance = new GameBoard());
 }
Example #2
0
        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();
        }