Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Task_ChangeState.h
Go to the documentation of this file.
1/**
2 * @file Task_ChangeState.h
3 * @brief Atomic task that changes the AI state stored in the LocalBlackboard.
4 * @author Olympe Engine
5 * @date 2026-03-08
6 *
7 * @details
8 * Task_ChangeState writes a new state string to the "local:CurrentState" key
9 * in the entity's LocalBlackboard. It is the standard way for VS graphs to
10 * transition between logical AI states (e.g. "Patrolling" -> "Alert" -> "Guard").
11 *
12 * Parameters (ParameterMap):
13 * "NewState" (String) — target state name (required).
14 *
15 * Returns:
16 * Success after writing the new state.
17 * Failure if "NewState" is missing, or if ctx.LocalBB is null.
18 *
19 * C++14 compliant - no C++17/20 features.
20 */
21
22#pragma once
23
24#include "../../IAtomicTask.h"
25
26namespace Olympe {
27
28/**
29 * @class Task_ChangeState
30 * @brief Sets "local:CurrentState" in the entity's LocalBlackboard.
31 */
32class Task_ChangeState : public IAtomicTask {
33public:
35
37 const ParameterMap& params) override;
38
40
41 void Abort() override;
42};
43
44} // namespace Olympe
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
std::unordered_map< std::string, TaskValue > ParameterMap
Convenience alias for the parameter map passed to Execute().
Definition IAtomicTask.h:67
TaskStatus Execute(const ParameterMap &params) override
Executes the atomic task for one frame.
TaskStatus ExecuteWithContext(const AtomicTaskContext &ctx, const ParameterMap &params) override
Executes the atomic task for one frame with full runtime context.
void Abort() override
Aborts the task, releasing any in-progress state.
< Provides AssetID and INVALID_ASSET_ID
TaskStatus
Result code returned by IAtomicTask::Execute().
Definition IAtomicTask.h:38
Lightweight context bundle passed to IAtomicTask::ExecuteWithContext().