示例#1
0
 public BossModeService(WindowsInputHandler inputHandler, List<TouchSequenceEntry> combinationToKillBoss, GameState gameState)
 {
     _inputHandler = inputHandler;
     _gameState = gameState;
     _combinationToKillBoss = combinationToKillBoss;
     _rhytmEngine = _gameState.Game.Services.GetService<RhythmEngine>();
 }
示例#2
0
        public override void LoadContent()
        {
            var game = ScreenManager.Game;
            GameState = game.Services.GetService<GameState>();

            // *********************************************************
            // DO NOT forget to remove all added here
            // services and game components on UnloadContent
            // *********************************************************

            var services = ScreenManager.Game.Services;

            services.AddService(ScreenManager);

            // Rhythm engine
            _rhythmEngine = new RhythmEngine(ScreenManager.Game);
            _rhythmEngine.Initialize();
            services.AddService(_rhythmEngine);

            _reactionCatalog = new ReactionsCatalog();
            services.AddService(_reactionCatalog);

            // Input
            _touchService = new TouchService();
            services.AddService(_touchService);

            _inputHandler = new WindowsInputHandler(ScreenManager.Game, this);
            _inputHandler.Initialize();

            _comboController = new ComboController(100);
            GameState.Combo = _comboController;

            GameState.Player.AddScript(new CheckForPickableObjectsScript(game));

            // Resources
            services.AddService(new ResourceBuilder(new InventoryMappingService()));

            Level.Initialize(ScreenManager.Game, ScreenManager.SpriteBatch, GameState.Camera, GameState);

            _comboController.Melodies.Clear();
            _comboController.Melodies[0] =
                new ComboLevelMelody(ScreenManager.Game.Content.Load<SoundEffect>(Level.MelodyAsset));
            _comboController.Initialize(ScreenManager.Game);

            GameState.Camera.Initialize(game);
            GameState.Player.Initialize(game, ScreenManager.SpriteBatch);
            _levelUI = new LevelUI(ScreenManager.Game);
            _levelUI.Initialize();

            // Effects
            _bloom = new BloomComponent(ScreenManager.Game);
            _bloom.Initialize();
            services.AddService(_bloom);

            InitializeReactions();
            WireUpEvents();

            ApplyDefaultMatchingStrategy();

            base.LoadContent();
        }