Beispiel #1
0
        protected override void OnStart(Core.GameState gameState)
        {
            _bloomComponent = gameState.Game.Services.GetService<BloomComponent>();

            for (int index = 0; index < gameState.Player.Nanobots.Count; index++)
            {
                var bot = gameState.Player.Nanobots[index];
                bot.Heal(HealBy);
            }

            base.OnStart(gameState);
        }
Beispiel #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();
        }