Manages NPC's and trainers and their behaviors.
More...
#include <AI.hpp>
|
| AI (Systems &owner) |
| Construct a new AI system. More...
|
|
virtual | ~AI ()=default |
| Destroys the system. More...
|
|
bool | addBehavior (bl::ecs::Entity entity, const file::Behavior &behavior) |
| Helper function for adding the given behavior to the given entity. More...
|
|
bool | makeStanding (bl::ecs::Entity entity, bl::tmap::Direction dir) |
| Makes the given entity stand in place. Replaces any existing behavior on the entity. More...
|
|
bool | makeSpinning (bl::ecs::Entity entity, file::Behavior::Spinning::Direction dir) |
| Makes the given entity spin in place. Replaces any existing behavior. More...
|
|
bool | makeFollowPath (bl::ecs::Entity entity, const file::Behavior::Path &path) |
| Make the entity follow a fixed path. Replaces existing behavior. More...
|
|
bool | makeWander (bl::ecs::Entity entity, unsigned int radius) |
| Makes the given entity wander around within the given radius. Replaces any existing behavior the entity may have. More...
|
|
bool | moveToPosition (bl::ecs::Entity entity, const bl::tmap::Position &dest) |
| Uses a pathfinder to navigate the entity to the given position and end up facing the given direction. The existing behavior is locked and left in the locked state when the path is completed. More...
|
|
void | removeAi (bl::ecs::Entity ent) |
| Removes any ai behavior from the given entity. Does not affect path finding. More...
|
|
Manages NPC's and trainers and their behaviors.
Definition at line 25 of file AI.hpp.
◆ AI()
core::system::AI::AI |
( |
Systems & |
owner | ) |
|
Construct a new AI system.
- Parameters
-
owner | The primary systems object |
Definition at line 26 of file AI.cpp.
◆ ~AI()
virtual core::system::AI::~AI |
( |
| ) |
|
|
virtualdefault |
◆ addBehavior()
bool core::system::AI::addBehavior |
( |
bl::ecs::Entity |
entity, |
|
|
const file::Behavior & |
behavior |
|
) |
| |
Helper function for adding the given behavior to the given entity.
- Parameters
-
entity | The entity to add the behavior to |
behavior | The behavior to add |
- Returns
- True if the behavior was able to be added, false otherwise
Definition at line 100 of file AI.cpp.
◆ makeFollowPath()
Make the entity follow a fixed path. Replaces existing behavior.
- Parameters
-
entity | The entity to go on the path |
path | The path to follow |
- Returns
- True if the behavior was added, false otherwise
Definition at line 136 of file AI.cpp.
◆ makeSpinning()
Makes the given entity spin in place. Replaces any existing behavior.
- Parameters
-
entity | The entity to spin |
dir | The direction to spin in |
- Returns
- True if the behavior was able to be added, false otherwise
Definition at line 126 of file AI.cpp.
◆ makeStanding()
bool core::system::AI::makeStanding |
( |
bl::ecs::Entity |
entity, |
|
|
bl::tmap::Direction |
dir |
|
) |
| |
Makes the given entity stand in place. Replaces any existing behavior on the entity.
- Parameters
-
entity | The entity to stand in place |
dir | The direction to face |
- Returns
- True if the behavior was able to be added, false otherwise
Definition at line 115 of file AI.cpp.
◆ makeWander()
bool core::system::AI::makeWander |
( |
bl::ecs::Entity |
entity, |
|
|
unsigned int |
radius |
|
) |
| |
Makes the given entity wander around within the given radius. Replaces any existing behavior the entity may have.
- Parameters
-
entity | The entity to wander around |
radius | The radius to stay within, in tiles |
- Returns
- True if the behavior was able to be added, false otherwise
Definition at line 146 of file AI.cpp.
◆ moveToPosition()
bool core::system::AI::moveToPosition |
( |
bl::ecs::Entity |
entity, |
|
|
const bl::tmap::Position & |
dest |
|
) |
| |
Uses a pathfinder to navigate the entity to the given position and end up facing the given direction. The existing behavior is locked and left in the locked state when the path is completed.
- Parameters
-
entity | The entity to navigate |
dest | The position to navigate to |
- Returns
- True if the controller was able to be added and the path is valid, false otherwise
Definition at line 164 of file AI.cpp.
◆ removeAi()
void core::system::AI::removeAi |
( |
bl::ecs::Entity |
ent | ) |
|
Removes any ai behavior from the given entity. Does not affect path finding.
- Parameters
-
ent | The entity to remove behavior from |
Definition at line 178 of file AI.cpp.
The documentation for this class was generated from the following files: