/// <summary> Initializes the component. Override this method to load any non-
        ///           graphics resources and query for any required services.</summary>
        public override void Initialize()
        {
            var contentManager = ServiceLocator.Current.GetInstance<ContentManager>();
            var theme = Game.Content.Load<Theme>("UI/UITheme");
            var renderer = new UIRenderer(Game, theme);
            var gameSettings = ServiceLocator.Current.GetInstance<GameSettings>();

            _gameBoardManager = new GameBoardManagerObject(_levelObjects[GameSettings.LevelNumber]);

            var content = ServiceLocator.Current.GetInstance<ContentManager>();
            Song music = content.Load<Song>(_levelObjects[GameSettings.LevelNumber]._backgroundSong);
            MediaPlayer.Play(music);
            MediaPlayer.IsRepeating = true;

            _aiHandler = new AIHandlerObject(_gameBoardManager);
            _camera = new CameraObject();

            // Create the inital game objects
            var gameObjectService = ServiceLocator.Current.GetInstance<IGameObjectService>();
            gameObjectService.Objects.Add(_camera);
            gameObjectService.Objects.Add(_gameBoardManager);
            gameObjectService.Objects.Add(_aiHandler);

            _gameHUD = new MainGameHUD("GameHUD", renderer, _gameBoardManager.TurnManager);

            var gameLog = ServiceLocator.Current.GetInstance<GameLog>();
            gameLog.ResetLog();

            var uiService = ServiceLocator.Current.GetInstance<IUIService>();
            uiService.Screens.Add(_gameHUD);
        }
示例#2
0
 /// <summary> Constructor.</summary>
 ///
 /// <param name="GameBoard"> The game board.</param>
 public AIHandlerObject(GameBoardManagerObject GameBoard)
 {
     GameBoardObj = GameBoard;
     IsAITurn = false;
     EndAITurn = false;
 }