示例#1
0
        /// <inheritdoc />
        public override void Initialize()
        {
            _pauseManager = IoCManager.Resolve <IPauseManager>();
            EntityQuery   = new TypeEntityQuery(typeof(PlayerInputMoverComponent));

            var moveUpCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleDirChange(session, Direction.North, true),
                session => HandleDirChange(session, Direction.North, false));
            var moveLeftCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleDirChange(session, Direction.West, true),
                session => HandleDirChange(session, Direction.West, false));
            var moveRightCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleDirChange(session, Direction.East, true),
                session => HandleDirChange(session, Direction.East, false));
            var moveDownCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleDirChange(session, Direction.South, true),
                session => HandleDirChange(session, Direction.South, false));
            var runCmdHandler = InputCmdHandler.FromDelegate(
                session => HandleRunChange(session, true),
                session => HandleRunChange(session, false));

            var input = EntitySystemManager.GetEntitySystem <InputSystem>();

            input.BindMap.BindFunction(EngineKeyFunctions.MoveUp, moveUpCmdHandler);
            input.BindMap.BindFunction(EngineKeyFunctions.MoveLeft, moveLeftCmdHandler);
            input.BindMap.BindFunction(EngineKeyFunctions.MoveRight, moveRightCmdHandler);
            input.BindMap.BindFunction(EngineKeyFunctions.MoveDown, moveDownCmdHandler);
            input.BindMap.BindFunction(EngineKeyFunctions.Run, runCmdHandler);
        }
示例#2
0
            public MapContext(IMapManager maps, ITileDefinitionManager tileDefs, IServerEntityManagerInternal entities, IPauseManager pauseManager)
            {
                _mapManager            = maps;
                _tileDefinitionManager = tileDefs;
                _serverEntityManager   = entities;
                _pauseManager          = pauseManager;

                RootNode = new YamlMappingNode();
            }
示例#3
0
            public MapContext(IMapManager maps, ITileDefinitionManager tileDefs, IServerEntityManagerInternal entities, IPauseManager pauseManager, YamlMappingNode node, IMap targetMap)
            {
                _mapManager            = maps;
                _tileDefinitionManager = tileDefs;
                _serverEntityManager   = entities;
                _pauseManager          = pauseManager;

                RootNode  = node;
                TargetMap = targetMap;
            }
示例#4
0
            public MapContext(IMapManagerInternal maps, ITileDefinitionManager tileDefs, IServerEntityManagerInternal entities, IPauseManager pauseManager, IComponentFactory componentFactory, IComponentManager componentManager)
            {
                _mapManager            = maps;
                _tileDefinitionManager = tileDefs;
                _serverEntityManager   = entities;
                _pauseManager          = pauseManager;
                _componentFactory      = componentFactory;
                _componentManager      = componentManager;

                RootNode = new YamlMappingNode();
            }
示例#5
0
            public MapContext(IMapManagerInternal maps, ITileDefinitionManager tileDefs, IServerEntityManagerInternal entities,
                              IPauseManager pauseManager, IComponentManager componentManager, IPrototypeManager prototypeManager, YamlMappingNode node, MapId targetMapId)
            {
                _mapManager            = maps;
                _tileDefinitionManager = tileDefs;
                _serverEntityManager   = entities;
                _pauseManager          = pauseManager;
                _componentManager      = componentManager;

                RootNode          = node;
                TargetMap         = targetMapId;
                _prototypeManager = prototypeManager;
            }
        public AiSystem()
        {
            // register entity query
            EntityQuery   = new TypeEntityQuery(typeof(AiControllerComponent));
            _pauseManager = IoCManager.Resolve <IPauseManager>();

            var reflectionMan = IoCManager.Resolve <IReflectionManager>();
            var processors    = reflectionMan.GetAllChildren <AiLogicProcessor>();

            foreach (var processor in processors)
            {
                var att = (AiLogicProcessorAttribute)Attribute.GetCustomAttribute(processor, typeof(AiLogicProcessorAttribute));
                if (att != null)
                {
                    _processorTypes.Add(att.SerializeName, processor);
                }
            }
        }
示例#7
0
 public static bool IsEntityPaused(this IPauseManager manager, IEntity entity)
 {
     return(!entity.HasComponent <IgnorePauseComponent>() && manager.IsGridPaused(entity.Transform.GridID));
 }
示例#8
0
 public static bool IsEntityPaused(this IPauseManager manager, IEntity entity)
 {
     return(entity.Paused);
 }
示例#9
0
        public override void Initialize()
        {
            base.Initialize();

            _pauseManager = IoCManager.Resolve <IPauseManager>();
        }