/// <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); }
public override void Startup() { base.Startup(); EntitySystemManager.Initialize(); Started = true; InitializeEntities(); }
public void Initialize() { LoadEntities(); EntitySystemManager.Initialize(); Initialized = true; InitializeEntities(); }
/// <inheritdoc /> public override void FrameUpdate(float frameTime) { var renderTreeSystem = EntitySystemManager.GetEntitySystem <RenderingTreeSystem>(); // So we could calculate the correct size of the entities based on the contents of their sprite... // Or we can just assume that no entity is larger than 10x10 and get a stupid easy check. var pvsBounds = _eyeManager.GetWorldViewport().Enlarged(5); var currentMap = _eyeManager.CurrentMap; if (currentMap == MapId.Nullspace) { return; } var mapTree = renderTreeSystem.GetSpriteTreeForMap(currentMap); mapTree.QueryAabb(ref frameTime, (ref float state, in SpriteComponent value) => { if (value.IsInert) { return(true); } value.FrameUpdate(state); return(true); }, pvsBounds, approx: true); }
public override void Initialize() { base.Initialize(); IoCManager.InjectDependencies(this); _inputSystem = EntitySystemManager.GetEntitySystem <InputSystem>(); }
public TransformSystem(EntityManager em, EntitySystemManager esm) : base(em, esm) { EntityQuery = new EntityQuery(); EntityQuery.AllSet.Add(typeof(TransformComponent)); EntityQuery.Exclusionset.Add(typeof(SlaveMoverComponent)); }
public override void Initialize() { var inputSys = EntitySystemManager.GetEntitySystem <InputSystem>(); inputSys.BindMap.BindFunction(ContentKeyFunctions.UseItemInHand, new PointerInputCmdHandler(HandleUseItemInHand)); inputSys.BindMap.BindFunction(ContentKeyFunctions.ActivateItemInWorld, new PointerInputCmdHandler((HandleUseItemInWorld))); }
private void DispatchGraph(SharedAiDebug.RequestPathfindingGraphMessage message) { var pathfindingSystem = EntitySystemManager.GetEntitySystem <PathfindingSystem>(); var mapManager = IoCManager.Resolve <IMapManager>(); var result = new Dictionary <int, List <Vector2> >(); var idx = 0; foreach (var(gridId, chunks) in pathfindingSystem.Graph) { var gridManager = mapManager.GetGrid(gridId); foreach (var chunk in chunks.Values) { var nodes = new List <Vector2>(); foreach (var node in chunk.Nodes) { var worldTile = gridManager.GridTileToWorldPos(node.TileRef.GridIndices); nodes.Add(worldTile); } result.Add(idx, nodes); idx++; } } var systemMessage = new SharedAiDebug.PathfindingGraphMessage(result); EntityManager.EntityNetManager.SendSystemNetworkMessage(systemMessage); }
/// <inheritdoc /> public override void Initialize() { EntityQuery = new TypeEntityQuery(typeof(IMoverComponent)); 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); SubscribeEvent <PlayerAttachSystemMessage>(PlayerAttached); SubscribeEvent <PlayerDetachedSystemMessage>(PlayerDetached); _audioSystem = EntitySystemManager.GetEntitySystem <AudioSystem>(); }
/// <inheritdoc /> public override void FrameUpdate(float frameTime) { var renderTreeSystem = EntitySystemManager.GetEntitySystem <RenderingTreeSystem>(); // So we could calculate the correct size of the entities based on the contents of their sprite... // Or we can just assume that no entity is larger than 10x10 and get a stupid easy check. var pvsBounds = _eyeManager.GetWorldViewport().Enlarged(5); var currentMap = _eyeManager.CurrentMap; if (currentMap == MapId.Nullspace) { return; } var mapTree = renderTreeSystem.GetSpriteTreeForMap(currentMap); var pvsEntities = mapTree.Query(pvsBounds, true); foreach (var sprite in pvsEntities) { if (sprite.IsInert) { continue; } sprite.FrameUpdate(frameTime); } }
public Layer(Application program) { m_App = program; m_Renderer2D = new Renderer2D(); m_EntityManager = new EntityContext(); m_EntitySystemManager = new EntitySystemManager(m_EntityManager); m_RenderSystem = new Render2DSystem(m_Renderer2D); }
public InventorySystem(EntityManager em, EntitySystemManager esm) : base(em, esm) { EntityQuery = new EntityQuery(); EntityQuery.OneSet.Add(typeof (InventoryComponent)); EntityQuery.OneSet.Add(typeof (EquipmentComponent)); EntityQuery.OneSet.Add(typeof (HumanHandsComponent)); }
public InventorySystem(EntityManager em, EntitySystemManager esm) : base(em, esm) { EntityQuery = new EntityQuery(); EntityQuery.OneSet.Add(typeof(NewInventoryComponent)); EntityQuery.OneSet.Add(typeof(NewEquipmentComponent)); EntityQuery.OneSet.Add(typeof(NewHandsComponent)); }
public override void Initialize() { IoCManager.InjectDependencies(this); var inputSys = EntitySystemManager.GetEntitySystem <InputSystem>(); inputSys.BindMap.BindFunction(ContentKeyFunctions.ExamineEntity, new PointerInputCmdHandler(HandleExamine)); }
#pragma warning restore 649 public override void Initialize() { base.Initialize(); var inputSys = EntitySystemManager.GetEntitySystem <InputSystem>(); inputSys.BindMap.BindFunction(ContentKeyFunctions.OpenCraftingMenu, new PointerInputCmdHandler(HandleOpenCraftingMenu)); }
#pragma warning restore 649 public override void Initialize() { base.Initialize(); var inputSystem = EntitySystemManager.GetEntitySystem <InputSystem>(); inputSystem.BindMap.BindFunction(ContentKeyFunctions.ToggleCombatMode, InputCmdHandler.FromDelegate(CombatModeToggled)); }
#pragma warning restore 649 public override void Initialize() { base.Initialize(); var inputSys = EntitySystemManager.GetEntitySystem <InputSystem>(); inputSys.BindMap.BindFunction(ContentKeyFunctions.OpenInventoryMenu, InputCmdHandler.FromDelegate(s => HandleOpenInventoryMenu())); }
public override void Initialize() { base.Initialize(); SubscribeLocalEvent <PlayerDetachedSystemMessage>(PlayerDetached); _audioSystem = EntitySystemManager.GetEntitySystem <AudioSystem>(); UpdatesBefore.Add(typeof(PhysicsSystem)); }
public PhysicsSystem(EntityManager em, EntitySystemManager esm) : base(em, esm) { EntityQuery = new EntityQuery(); EntityQuery.AllSet.Add(typeof(PhysicsComponent)); EntityQuery.AllSet.Add(typeof(VelocityComponent)); EntityQuery.AllSet.Add(typeof(TransformComponent)); EntityQuery.Exclusionset.Add(typeof(SlaveMoverComponent)); EntityQuery.Exclusionset.Add(typeof(PlayerInputMoverComponent)); }
public void Update() { float time = Time.time; float deltaTime = Time.deltaTime; // must be done every frame AnimationManager.Update(time, deltaTime); EntityManager.Update(time, deltaTime); EntitySystemManager.Update(time, deltaTime); }
public override void Shutdown() { //WARN: Tightly couples this system with InputSystem, and assumes InputSystem exists and is initialized var inputSystem = EntitySystemManager.GetEntitySystem <InputSystem>(); inputSystem.BindMap.UnbindFunction(EngineKeyFunctions.CameraRotateRight); inputSystem.BindMap.UnbindFunction(EngineKeyFunctions.CameraRotateLeft); base.Shutdown(); }
public override void InitializeEntities() { if (Initialized) { throw new InvalidOperationException("InitializeEntities() called multiple times"); } base.InitializeEntities(); EntitySystemManager.Initialize(); Initialized = true; }
public override void Initialize() { base.Initialize(); _gameHud.OnCombatModeChanged = OnCombatModeChanged; _gameHud.OnTargetingZoneChanged = OnTargetingZoneChanged; _inputSystem = EntitySystemManager.GetEntitySystem <InputSystem>(); _inputSystem.BindMap.BindFunction(ContentKeyFunctions.ToggleCombatMode, InputCmdHandler.FromDelegate(CombatModeToggled)); }
public override void Initialize() { base.Initialize(); IoCManager.InjectDependencies(this); var input = EntitySystemManager.GetEntitySystem <InputSystem>(); input.BindMap.BindFunction(ContentKeyFunctions.OpenContextMenu, new PointerInputCmdHandler(OnOpenContextMenu)); }
private const float ThrowForce = 1.5f; // Throwing force of mobs in Newtons /// <inheritdoc /> public override void Initialize() { base.Initialize(); var input = EntitySystemManager.GetEntitySystem <InputSystem>(); input.BindMap.BindFunction(ContentKeyFunctions.SwapHands, InputCmdHandler.FromDelegate(HandleSwapHands)); input.BindMap.BindFunction(ContentKeyFunctions.Drop, new PointerInputCmdHandler(HandleDrop)); input.BindMap.BindFunction(ContentKeyFunctions.ActivateItemInHand, InputCmdHandler.FromDelegate(HandleActivateItem)); input.BindMap.BindFunction(ContentKeyFunctions.ThrowItemInHand, new PointerInputCmdHandler(HandleThrowItem)); }
public override void Initialize() { base.Initialize(); EntityQuery = new TypeEntityQuery(typeof(EyeComponent)); //WARN: Tightly couples this system with InputSystem, and assumes InputSystem exists and is initialized var inputSystem = EntitySystemManager.GetEntitySystem <InputSystem>(); inputSystem.BindMap.BindFunction(EngineKeyFunctions.CameraRotateRight, new NullInputCmdHandler()); inputSystem.BindMap.BindFunction(EngineKeyFunctions.CameraRotateLeft, new NullInputCmdHandler()); }
public override void Startup() { base.Startup(); if (Started) { throw new InvalidOperationException("Startup() called multiple times"); } EntitySystemManager.Initialize(); Started = true; }
#pragma warning restore 649 public override void Initialize() { base.Initialize(); SubscribeNetworkEvent <SetTargetZoneMessage>(SetTargetZoneHandler); SubscribeNetworkEvent <SetCombatModeActiveMessage>(SetCombatModeActiveHandler); var inputSystem = EntitySystemManager.GetEntitySystem <InputSystem>(); inputSystem.BindMap.BindFunction(ContentKeyFunctions.ToggleCombatMode, InputCmdHandler.FromDelegate(CombatModeToggled)); }
public override void Initialize() { base.Initialize(); _gameHud.OnCombatModeChanged = OnCombatModeChanged; _gameHud.OnTargetingZoneChanged = OnTargetingZoneChanged; _inputSystem = EntitySystemManager.GetEntitySystem <InputSystem>(); _inputSystem.BindMap.BindFunction(ContentKeyFunctions.UseOrAttack, new InputHandler(this)); _overlayManager.AddOverlay(new CombatModeOverlay(this)); }
#pragma warning restore 649 public override void Initialize() { base.Initialize(); var inputSys = EntitySystemManager.GetEntitySystem <InputSystem>(); CommandBinds.Builder .Bind(ContentKeyFunctions.OpenCraftingMenu, new PointerInputCmdHandler(HandleOpenCraftingMenu)) .Bind(EngineKeyFunctions.Use, new PointerInputCmdHandler(HandleUse)) .Register <ConstructorSystem>(); }
public override void Initialize() { base.Initialize(); SubscribeNetworkEvent <VerbSystemMessages.VerbsResponseMessage>(FillEntityPopup); IoCManager.InjectDependencies(this); var input = EntitySystemManager.GetEntitySystem <InputSystem>(); input.BindMap.BindFunction(ContentKeyFunctions.OpenContextMenu, new PointerInputCmdHandler(OnOpenContextMenu)); }
public InteractionSystem(EntityManager em, EntitySystemManager esm) : base(em, esm) {}
public InventorySystem(EntityManager em, EntitySystemManager esm) : base(em, esm) { EntityQuery = new EntityQuery(); }
public InputSystem(EntityManager em, EntitySystemManager esm) : base(em, esm) { EntityQuery = new EntityQuery(); EntityQuery.OneSet.Add(typeof (KeyBindingInputComponent)); }
public EntityProcessingSystem(EntityManager em, EntitySystemManager esm):base(em, esm) {}
public ParticleSystem(EntityManager em, EntitySystemManager esm) : base(em, esm) { EntityQuery = new EntityQuery(); EntityQuery.OneSet.Add(typeof(ParticleSystemComponent)); }
public EntityEventHandlingSystem(EntityManager em, EntitySystemManager esm):base(em, esm) {}
public TestSystem(EntityManager em, EntitySystemManager esm) : base(em, esm) { EntityQuery = new EntityQuery(); EntityQuery.OneSet.Add(typeof (BasicItemComponent)); }
public EntitySystem(EntityManager em, EntitySystemManager esm) { EntityManager = em; EntitySystemManager = esm; }