public GameController( Game game, ICollisionDetectionService collisionDetectionService, IPlayerService playerService, IEnemyService enemyService, IInputService inputService, IHeadUpDisplayService headUpDisplayService, ITerrainService terrainService, IAudioService audioService) : base(game) { this.game = game; this.collisionDetectionService = collisionDetectionService; this.playerService = playerService; this.enemyService = enemyService; this.inputService = inputService; this.headUpDisplayService = headUpDisplayService; this.terrainService = terrainService; this.audioService = audioService; this.inputService.AnalogPauseChanged += delegate { this.isGamePaused = !this.isGamePaused; }; this.inputService.PauseChanged += delegate { this.isGamePaused = !this.isGamePaused; }; this.fadeEffect = "FadeIn"; }
private void ComposeServices() { this.terrainService = new TerrainService( this); this.headUpDisplayService = new HeadUpDisplayService( this); this.audioService = new AudioService( this); this.enemyFactory = new EnemyFactory( this, terrainService); this.enemyService = new EnemyService( this, enemyFactory); this.playerFactory = new PlayerFactory( this); this.inputService = new InputService( this); this.playerService = new PlayerService( this, inputService, audioService, playerFactory, terrainService); this.collisionDetectionService = new CollisionDetectionService( this, playerService, enemyService, terrainService); this.gameController = new GameController( this, collisionDetectionService, playerService, enemyService, inputService, headUpDisplayService, terrainService, audioService); try { var consoleAssembly = Assembly.Load("SpaceFighter.Console"); var consoleServiceType = consoleAssembly.GetType("SpaceFighter.Console.ConsoleService"); var consoleService = Activator.CreateInstance(consoleServiceType, this); this.Components.Add(consoleService as IGameComponent); } catch(FileNotFoundException) { // No console support available } }