Exemplo n.º 1
0
        private void InitSystems()
        {
            _systemsManager = new SystemsManager();
            _systemsManager.Push(new PlayerInputHandlingSystem(IntentProvider, _configurationService));
            _systemsManager.Push(new CommandHandlingSystem());
            _systemsManager.Push(new SpriteDrawingSystem(ContentManager, SpriteBatch));
            _systemsManager.Push(new AnimationSystem(_configurationService.GetFps()));
            _systemsManager.Push(new MoveToScreenPositionSystem());
            _systemsManager.Push(new TileEventsSystem());

            var fsmSystem = new FsmSystem();

            fsmSystem.RegisterHandler(new PlayerIdleHandler(ContentManager, InputMapProvider));
            fsmSystem.RegisterHandler(new PlayerMovingHandler(InputMapProvider));
            fsmSystem.RegisterHandler(new PlayerDeadHandler());
            fsmSystem.RegisterHandler(new TileDestroyedHandler());
            fsmSystem.RegisterHandler(new TileTouchedHandler());
            fsmSystem.RegisterHandler(new EndOpenHandler());
            _systemsManager.Push(fsmSystem);

            _systemsManager.Peek <PlayerInputHandlingSystem>().SetActive(true);
            _systemsManager.Peek <CommandHandlingSystem>().SetActive(true);
            _systemsManager.Peek <SpriteDrawingSystem>().SetActive(true);
            _systemsManager.Peek <AnimationSystem>().SetActive(true);
            _systemsManager.Peek <MoveToScreenPositionSystem>().SetActive(true);
            _systemsManager.Peek <FsmSystem>().SetActive(true);
            _systemsManager.Peek <TileEventsSystem>().SetActive(true);
        }