Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Task_MoveToLocation.h
Go to the documentation of this file.
1/**
2 * @file Task_MoveToLocation.h
3 * @brief Atomic task that moves an entity toward a target location.
4 * @author Olympe Engine
5 * @date 2026-02-23
6 *
7 * @details
8 * Task_MoveToLocation moves an entity toward a specified target position.
9 * It operates in dual mode:
10 * - World mode : if ctx.WorldPtr is set and the entity has a position
11 * component, that component is read and updated directly.
12 * - Headless mode: reads and writes the "Position" key in ctx.LocalBB,
13 * integrating position analytically using ctx.DeltaTime.
14 *
15 * Parameters (ParameterMap):
16 * "Target" (Vector) - destination position (required)
17 * "Speed" (Float) - units per second (optional, default 100.0)
18 *
19 * Returns:
20 * Running while the entity is more than a small tolerance from Target.
21 * Success once the entity reaches the target (or snaps to it on the
22 * final step).
23 * Failure if the "Position" BB key is missing in headless mode.
24 *
25 * C++14 compliant - no C++17/20 features.
26 */
27
28#pragma once
29
30#include "../../IAtomicTask.h"
31
32namespace Olympe {
33
34/**
35 * @class Task_MoveToLocation
36 * @brief Moves an entity toward a target location each tick.
37 */
39public:
41
43 const ParameterMap& params) override;
44
45 TaskStatus Execute(const ParameterMap& params) override;
46
47 void Abort() override;
48};
49
50} // namespace Olympe
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
Abstract interface for a single atomic unit of work.
Definition IAtomicTask.h:63
std::unordered_map< std::string, TaskValue > ParameterMap
Convenience alias for the parameter map passed to Execute().
Definition IAtomicTask.h:67
Moves an entity toward a target location each tick.
void Abort() override
Aborts the task, releasing any in-progress state.
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.
< Provides AssetID and INVALID_ASSET_ID
TaskStatus
Result code returned by IAtomicTask::Execute().
Definition IAtomicTask.h:38
Lightweight context bundle passed to IAtomicTask::ExecuteWithContext().