#include <aiparticlemanager.h>
Public Types | |
| typedef std::pair< float, dtCore::RefPtr< BaseNPC > > | AgentParticle |
| typedef std::list< AgentParticle > | ParticleList |
| typedef std::list< BaseNPC * > | AgentList |
| typedef dtUtil::Functor < AgentParticle, TYPELIST_1(AgentParticle &)> | CloneFunctor |
| typedef dtUtil::Functor< bool, TYPELIST_1(AgentParticle &)> | FilterFunctor |
Public Member Functions | |
| AIParticleManager (const CloneFunctor &pClone, const FilterFunctor &pFilter) | |
| void | AddAgent (BaseNPC *pAgent, float pProbability) |
| Adds a new agent to the particle list with the assigned probability. | |
| BaseNPC * | CloneAgent (BaseNPC *pAgent) |
| Clones a given agent and adds it to the particle list, uses the CloneFunctor assigned in the constructor. | |
| void | RemoveAgent (BaseNPC *pAgent) |
| Adds the given agent to the remove list, it is important to note that the agent won't actually be removed until update. | |
| void | RemoveAgents (const AgentList &pList) |
| Removes all the agents in the list from the particle list this function will remove the agents immediately and re-normalize the probability pool. | |
| void | CombineAgents (BaseNPC *pAgentToDelete, BaseNPC *pAgentToAddTo) |
| Adds one agent to the remove list and adds its probability to the other agent instead of equally re-normalizing probabilities which would happen if the agent was simply just removed. | |
| void | ClearAllAgents () |
| Removes all agents from the list, happens immediately. | |
| void | UpdateAgents (double dt) |
| Updates all agents, filters them using the filter function assigned in the constructor, pops off all excess particles of least probability (use SetMaxAgents() to adjust this number, removes all agents that are on the remove list and the re-normalizes the remaining particles probabilities. | |
| const ParticleList & | GetParticleList () const |
| Returns a const version of the particle list. | |
| ParticleList & | GetParticleList () |
| Returns a non const version of the particle list NOTE: unexpected behavoir will result if agent particles are removed from this list, please use RemoveAgent() for that. | |
| unsigned | GetMaxAgents () const |
| Returns the max number of agents allowed, when the agent list gets too big the agents of least probability are removed from the list. | |
| void | SetMaxAgents (unsigned pMaxAgents) |
| Sets the maximum number of allowable agents, additional agents are removed on update starting with the least probable. | |
| AgentParticle * | GetAgentParticle (BaseNPC *pNPC) |
| Given a pointer to a BaseNPC, this returns the associated AgentParticle in the list. | |
| bool | InRemoveList (const BaseNPC *pNPC) const |
| Returns true if an NPC has been added to the remove list, and will be removed on update. | |
Protected Member Functions | |
| virtual | ~AIParticleManager () |
| typedef std::pair<float, dtCore::RefPtr<BaseNPC> > dtAI::AIParticleManager::AgentParticle |
| typedef std::list<AgentParticle> dtAI::AIParticleManager::ParticleList |
| typedef std::list<BaseNPC*> dtAI::AIParticleManager::AgentList |
| typedef dtUtil::Functor<AgentParticle, TYPELIST_1(AgentParticle&)> dtAI::AIParticleManager::CloneFunctor |
| typedef dtUtil::Functor<bool, TYPELIST_1(AgentParticle&)> dtAI::AIParticleManager::FilterFunctor |
| dtAI::AIParticleManager::AIParticleManager | ( | const CloneFunctor & | pClone, | |
| const FilterFunctor & | pFilter | |||
| ) |
| dtAI::AIParticleManager::~AIParticleManager | ( | ) | [protected, virtual] |
| void dtAI::AIParticleManager::AddAgent | ( | BaseNPC * | pAgent, | |
| float | pProbability | |||
| ) |
Adds a new agent to the particle list with the assigned probability.
Clones a given agent and adds it to the particle list, uses the CloneFunctor assigned in the constructor.
| void dtAI::AIParticleManager::RemoveAgent | ( | BaseNPC * | pAgent | ) |
Adds the given agent to the remove list, it is important to note that the agent won't actually be removed until update.
once the agents are removed the probabilities are renormalized
| void dtAI::AIParticleManager::RemoveAgents | ( | const AgentList & | pList | ) |
Removes all the agents in the list from the particle list this function will remove the agents immediately and re-normalize the probability pool.
Adds one agent to the remove list and adds its probability to the other agent instead of equally re-normalizing probabilities which would happen if the agent was simply just removed.
| void dtAI::AIParticleManager::ClearAllAgents | ( | ) |
Removes all agents from the list, happens immediately.
| void dtAI::AIParticleManager::UpdateAgents | ( | double | dt | ) |
Updates all agents, filters them using the filter function assigned in the constructor, pops off all excess particles of least probability (use SetMaxAgents() to adjust this number, removes all agents that are on the remove list and the re-normalizes the remaining particles probabilities.
| const AIParticleManager::ParticleList & dtAI::AIParticleManager::GetParticleList | ( | ) | const |
Returns a const version of the particle list.
| AIParticleManager::ParticleList & dtAI::AIParticleManager::GetParticleList | ( | ) |
Returns a non const version of the particle list NOTE: unexpected behavoir will result if agent particles are removed from this list, please use RemoveAgent() for that.
| unsigned dtAI::AIParticleManager::GetMaxAgents | ( | ) | const |
Returns the max number of agents allowed, when the agent list gets too big the agents of least probability are removed from the list.
| void dtAI::AIParticleManager::SetMaxAgents | ( | unsigned | pMaxAgents | ) |
Sets the maximum number of allowable agents, additional agents are removed on update starting with the least probable.
| AIParticleManager::AgentParticle * dtAI::AIParticleManager::GetAgentParticle | ( | BaseNPC * | pNPC | ) |
Given a pointer to a BaseNPC, this returns the associated AgentParticle in the list.
| bool dtAI::AIParticleManager::InRemoveList | ( | const BaseNPC * | pNPC | ) | const |
Returns true if an NPC has been added to the remove list, and will be removed on update.