aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-12-09 11:28:06 +0100
committermax-001 <maxsmits21@kpnmail.nl>2024-12-09 11:28:06 +0100
commit6cee1cff083fc50eeedf88537965d3c79e7b790a (patch)
tree7e292157b73ab6d10e4ff3a63ddc5d5a909d009d /src/crepe/system
parent33a072db28d71ba65e59f9491abd42dbf9695fc4 (diff)
Added Doxygen
Diffstat (limited to 'src/crepe/system')
-rw-r--r--src/crepe/system/AISystem.cpp1
-rw-r--r--src/crepe/system/AISystem.h44
2 files changed, 45 insertions, 0 deletions
diff --git a/src/crepe/system/AISystem.cpp b/src/crepe/system/AISystem.cpp
index 55dc14c..7b801c3 100644
--- a/src/crepe/system/AISystem.cpp
+++ b/src/crepe/system/AISystem.cpp
@@ -17,6 +17,7 @@ void AISystem::update() {
ComponentManager & mgr = mediator.component_manager;
RefVector<AI> ai_components = mgr.get_components_by_type<AI>();
+ //TODO: Use fixed loop dt (this is not available at master at the moment)
double dt = LoopTimer::get_instance().get_delta_time();
for (AI & ai : ai_components) {
diff --git a/src/crepe/system/AISystem.h b/src/crepe/system/AISystem.h
index 27861d9..670d20d 100644
--- a/src/crepe/system/AISystem.h
+++ b/src/crepe/system/AISystem.h
@@ -7,19 +7,63 @@
namespace crepe {
+/**
+ * \brief The AISystem is used to control the movement of entities using AI.
+ *
+ * The AISystem is used to control the movement of entities using AI. The AISystem can be used to
+ * implement different behaviors such as seeking, fleeing, arriving, and path following.
+ */
class AISystem : public System {
public:
using System::System;
+ //! Update the AI system
void update() override;
private:
+ /**
+ * \brief Calculate the total force to apply to the entity
+ *
+ * \param ai The AI component
+ */
vec2 calculate(AI & ai);
+ /**
+ * \brief Accumulate the force to apply to the entity
+ *
+ * \param ai The AI component
+ * \param running_total The running total of the force
+ * \param force_to_add The force to add
+ * \return true if the force was added, false otherwise
+ */
bool accumulate_force(AI & ai, vec2 & running_total, vec2 force_to_add);
+ /**
+ * \brief Calculate the seek force
+ *
+ * \param ai The AI component
+ * \return The seek force
+ */
vec2 seek(const AI & ai);
+ /**
+ * \brief Calculate the flee force
+ *
+ * \param ai The AI component
+ * \return The flee force
+ */
vec2 flee(const AI & ai);
+ /**
+ * \brief Calculate the arrive force
+ *
+ * \param ai The AI component
+ * \return The arrive force
+ */
vec2 arrive(const AI & ai);
+ /**
+ * \brief Calculate the path follow force
+ *
+ * \param ai The AI component
+ * \return The path follow force
+ */
vec2 path_follow(AI & ai);
};