Olympe Engine
2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Source
TaskSystem
AtomicTasks
AI
Task_GotoPosition.h
Go to the documentation of this file.
1
/**
2
* @file Task_GotoPosition.h
3
* @brief Atomic task that moves an entity toward a 2D target position.
4
* @author Olympe Engine
5
* @date 2026-03-08
6
*
7
* @details
8
* Task_GotoPosition moves the entity toward (TargetX, TargetY) each frame.
9
* In headless mode it integrates the entity's "Position" key in the
10
* LocalBlackboard using ctx.DeltaTime. In World mode it writes Velocity
11
* to the MovementComponent via the ComponentFacade.
12
*
13
* Parameters (ParameterMap):
14
* "TargetX" (Float) — X coordinate of the destination (required).
15
* "TargetY" (Float) — Y coordinate of the destination (required).
16
* "Speed" (Float) — Movement speed in units/s (optional, default 300.0).
17
*
18
* Returns:
19
* Running while the entity is more than 5 units from the target.
20
* Success once the entity arrives (distance <= 5 units).
21
* Success immediately when ctx.World is nullptr (headless/test mode).
22
* Failure if "TargetX" or "TargetY" parameters are missing.
23
*
24
* C++14 compliant - no C++17/20 features.
25
*/
26
27
#pragma once
28
29
#include "../../IAtomicTask.h"
30
31
namespace
Olympe
{
32
33
/**
34
* @class Task_GotoPosition
35
* @brief Moves an entity toward a 2D (TargetX, TargetY) destination.
36
*/
37
class
Task_GotoPosition
:
public
IAtomicTask
{
38
public
:
39
Task_GotoPosition
();
40
41
TaskStatus
ExecuteWithContext
(
const
AtomicTaskContext
&
ctx
,
42
const
ParameterMap
&
params
)
override
;
43
44
TaskStatus
Execute
(
const
ParameterMap
&
params
)
override
;
45
46
void
Abort
()
override
;
47
};
48
49
}
// namespace Olympe
GetComponentTypeID_Static
ComponentTypeID GetComponentTypeID_Static()
Definition
ECS_Entity.h:56
Olympe::IAtomicTask
Abstract interface for a single atomic unit of work.
Definition
IAtomicTask.h:63
Olympe::IAtomicTask::ParameterMap
std::unordered_map< std::string, TaskValue > ParameterMap
Convenience alias for the parameter map passed to Execute().
Definition
IAtomicTask.h:67
Olympe::Task_GotoPosition
Moves an entity toward a 2D (TargetX, TargetY) destination.
Definition
Task_GotoPosition.h:37
Olympe::Task_GotoPosition::ExecuteWithContext
TaskStatus ExecuteWithContext(const AtomicTaskContext &ctx, const ParameterMap ¶ms) override
Executes the atomic task for one frame with full runtime context.
Definition
Task_GotoPosition.cpp:36
Olympe::Task_GotoPosition::Execute
TaskStatus Execute(const ParameterMap ¶ms) override
Executes the atomic task for one frame.
Definition
Task_GotoPosition.cpp:31
Olympe::Task_GotoPosition::Abort
void Abort() override
Aborts the task, releasing any in-progress state.
Definition
Task_GotoPosition.cpp:26
Olympe::Task_GotoPosition::Task_GotoPosition
Task_GotoPosition()
Definition
Task_GotoPosition.cpp:24
Olympe
< Provides AssetID and INVALID_ASSET_ID
Definition
BTEditorCommand.cpp:16
Olympe::TaskStatus
TaskStatus
Result code returned by IAtomicTask::Execute().
Definition
IAtomicTask.h:38
Olympe::AtomicTaskContext
Lightweight context bundle passed to IAtomicTask::ExecuteWithContext().
Definition
AtomicTaskContext.h:36
Generated on Mon Apr 13 2026 08:15:20 for Olympe Engine by
1.9.8