Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Olympe::Task_Flee Class Reference

Moves an entity away from a 2D threat position until safe distance is reached. More...

#include <Task_Flee.h>

+ Inheritance diagram for Olympe::Task_Flee:
+ Collaboration diagram for Olympe::Task_Flee:

Public Member Functions

 Task_Flee ()
 
TaskStatus ExecuteWithContext (const AtomicTaskContext &ctx, const ParameterMap &params) override
 Executes the atomic task for one frame with full runtime context.
 
TaskStatus Execute (const ParameterMap &params) override
 Executes the atomic task for one frame.
 
void Abort () override
 Aborts the task, releasing any in-progress state.
 
 Task_Flee ()
 
TaskStatus ExecuteWithContext (const AtomicTaskContext &ctx, const ParameterMap &params) override
 Executes the atomic task for one frame with full runtime context.
 
TaskStatus Execute (const ParameterMap &params) override
 Executes the atomic task for one frame.
 
void Abort () override
 Aborts the task, releasing any in-progress state.
 
- Public Member Functions inherited from Olympe::IAtomicTask
virtual ~IAtomicTask ()=default
 

Additional Inherited Members

- Public Types inherited from Olympe::IAtomicTask
using ParameterMap = std::unordered_map< std::string, TaskValue >
 Convenience alias for the parameter map passed to Execute().
 

Detailed Description

Moves an entity away from a 2D threat position until safe distance is reached.

Computes a flee direction and stores the target position in LocalBB.

Definition at line 36 of file Task_Flee.h.

Constructor & Destructor Documentation

◆ Task_Flee() [1/2]

Olympe::Task_Flee::Task_Flee ( )

Definition at line 23 of file Task_Flee.cpp.

◆ Task_Flee() [2/2]

Olympe::Task_Flee::Task_Flee ( )

Member Function Documentation

◆ Abort() [1/2]

void Olympe::Task_Flee::Abort ( )
overridevirtual

Aborts the task, releasing any in-progress state.

Called by the TaskSystem when execution is interrupted (e.g. a parent node is aborted or a new graph is bound while a task is Running). Concrete tasks must implement this to clean up timers, reservations, animations, or any other side-effects started in Execute().

Implements Olympe::IAtomicTask.

Definition at line 25 of file Task_Flee.cpp.

References SYSTEM_LOG.

◆ Abort() [2/2]

void Olympe::Task_Flee::Abort ( )
overridevirtual

Aborts the task, releasing any in-progress state.

Called by the TaskSystem when execution is interrupted (e.g. a parent node is aborted or a new graph is bound while a task is Running). Concrete tasks must implement this to clean up timers, reservations, animations, or any other side-effects started in Execute().

Implements Olympe::IAtomicTask.

◆ Execute() [1/2]

TaskStatus Olympe::Task_Flee::Execute ( const ParameterMap params)
overridevirtual

Executes the atomic task for one frame.

Parameters
paramsNamed parameters provided by the task graph node.
Returns
TaskStatus::Success, Failure, or Running. Returning Running causes the task to be ticked again next frame.

Implements Olympe::IAtomicTask.

Definition at line 30 of file Task_Flee.cpp.

References Olympe::Failure.

◆ Execute() [2/2]

TaskStatus Olympe::Task_Flee::Execute ( const ParameterMap params)
overridevirtual

Executes the atomic task for one frame.

Parameters
paramsNamed parameters provided by the task graph node.
Returns
TaskStatus::Success, Failure, or Running. Returning Running causes the task to be ticked again next frame.

Implements Olympe::IAtomicTask.

◆ ExecuteWithContext() [1/2]

TaskStatus Olympe::Task_Flee::ExecuteWithContext ( const AtomicTaskContext ctx,
const ParameterMap params 
)
overridevirtual

Executes the atomic task for one frame with full runtime context.

New tasks should override this method to access the richer context (World pointer, LocalBlackboard, EntityID, dt, StateTimer). The default implementation simply forwards to Execute(params) so all existing tasks remain compatible without any changes.

Parameters
ctxRuntime context for this tick (Entity, World*, LocalBB, dt, StateTimer).
paramsNamed parameters provided by the task graph node.
Returns
TaskStatus::Success, Failure, or Running.

Reimplemented from Olympe::IAtomicTask.

Definition at line 35 of file Task_Flee.cpp.

References Olympe::TaskValue::AsVector(), Olympe::DEFAULT_FLEE_DISTANCE, Olympe::Failure, Olympe::FLEE_MOVE_SPEED, Olympe::Float, GetComponentTypeID_Static(), Olympe::Int, Olympe::Running, Olympe::Success, SYSTEM_LOG, Olympe::Vector, and Vector::z.

+ Here is the call graph for this function:

◆ ExecuteWithContext() [2/2]

TaskStatus Olympe::Task_Flee::ExecuteWithContext ( const AtomicTaskContext ctx,
const ParameterMap params 
)
overridevirtual

Executes the atomic task for one frame with full runtime context.

New tasks should override this method to access the richer context (World pointer, LocalBlackboard, EntityID, dt, StateTimer). The default implementation simply forwards to Execute(params) so all existing tasks remain compatible without any changes.

Parameters
ctxRuntime context for this tick (Entity, World*, LocalBB, dt, StateTimer).
paramsNamed parameters provided by the task graph node.
Returns
TaskStatus::Success, Failure, or Running.

Reimplemented from Olympe::IAtomicTask.


The documentation for this class was generated from the following files: