Managers are objects which care about some specific functionality of a feature.
Definition manager.h:32
A container of entities, their components, and processors.
Definition world.h:92
void OnDeactivate() override
free every crowd
Definition agentmanager.cc:835
Util::Array< dtCrowd * > stepping
the crowds the jobs step, signalled when the last is done
Definition agentmanager.h:113
static void DecayAgent(Game::World *world, Game::Entity entity, NavAgent *component)
remove the agent of a NavAgent component
Definition agentmanager.cc:347
static void WaitForCrowds()
wait until no crowd steps in a job, before a crowd or its navmesh is changed or freed
Definition agentmanager.cc:598
static void UpdateAgents(Game::World *world, float dt)
join agents to crowds, step the crowds by dt and move the entities.
Definition agentmanager.cc:588
Game::World * startedWorld
the update which was started and not finished, and how far it steps
Definition agentmanager.h:117
__DeclareClass(AgentManager) __DeclareSingleton(AgentManager)
void OnCleanup(Game::World *world) override
free the crowds of a world which is cleaned up
Definition agentmanager.cc:884
static void StartUpdate(Game::World *world, float dt)
join agents to crowds, follow the entities, hand out paths, and start the crowds stepping by dt in jo...
Definition agentmanager.cc:614
void OnEndFrame() override
finish the update, wait for the crowds and move the entities
Definition agentmanager.cc:870
static void FinishUpdate(Game::World *world)
wait for the crowds of the update started last, and move the entities
Definition agentmanager.cc:736
static void InitAgent(Game::World *world, Game::Entity entity, NavAgent *component)
register the agent of a NavAgent component
Definition agentmanager.cc:323
AgentManager()
constructor
Definition agentmanager.cc:110
void OnActivate() override
listen for navmesh reloads
Definition agentmanager.cc:822
friend struct AgentAccess
Definition agentmanager.h:108
bool crowdsStepping
Definition agentmanager.h:115
void OnFrame() override
start the update of the agents of the default world, the crowds step in jobs
Definition agentmanager.cc:855
Util::Array< CrowdRecord * > crowds
Definition agentmanager.h:110
Threading::Event steppingDone
Definition agentmanager.h:114
Util::Array< AgentRecord * > agents
Definition agentmanager.h:109
float startedDt
Definition agentmanager.h:118
Nebula's dynamic array class.
Definition array.h:61
Queries on a loaded navmesh.
Definition agentmanager.cc:30
void DrawAgents()
draw the agents, their targets and the corners ahead of them
Definition agentmanager.cc:1012
void StopMoving(Game::World *world, Game::Entity entity)
stop where the agent is
Definition agentmanager.cc:935
Math::vec3 GetAgentVelocity(Game::World *world, Game::Entity entity)
the velocity the crowd moves the agent with, zero if it isn't moving
Definition agentmanager.cc:976
Util::Array< Math::point > GetAgentCorners(Game::World *world, Game::Entity entity)
the corners of the path ahead of the agent, the next few the crowd steers by
Definition agentmanager.cc:991
MoveState
Definition agentmanager.h:54
@ Arrived
at the target
Definition agentmanager.h:60
@ Unreachable
the target can't be reached, the agent stopped at the closest point it can reach
Definition agentmanager.h:62
@ NoNavMesh
there is a target, but no navmesh is loaded for the agent kind yet
Definition agentmanager.h:66
@ Moving
walking to the target
Definition agentmanager.h:58
@ Idle
no target
Definition agentmanager.h:56
bool SetMoveTarget(Game::World *world, Game::Entity entity, const Math::point &target)
walk to a target. Returns false if the entity has no NavAgent
Definition agentmanager.cc:912
MoveState GetMoveState(Game::World *world, Game::Entity entity)
what the agent is doing, Idle if the entity has no NavAgent
Definition agentmanager.cc:966
#define __DeclareSingleton(type)
Definition osxsingleton.h:24
An entity is essentially just an Id with some utility functions attached.
Definition entity.h:35
Represents a 3D point in space.
Definition point.h:22
A 3D vector.
Definition vec3.h:37
Definition agentmanager.cc:63
Definition agentmanager.cc:50