50 [[nodiscard]]
bool canAct(
Entity entity, Args&&... args)
noexcept(std::is_nothrow_constructible_v<Action, Args...>);
58 template<CEntityAction Action> [[nodiscard]]
bool canAct(
Entity entity,
const Action& action)
noexcept;
73 template<CEntityAction Action>
typename Action::ReturnType
act(
Entity entity,
const Action& action);
101#include "ActionManager.inl"
#define CE_SCRIPT_EXPORT(...)
The CE_SCRIPT_EXPORT macro marks a class or method as exportable and available in scripting environme...
Definition Macros.hpp:247
Definition ActionHandler.hpp:17
Definition ActionHandler.hpp:23
Definition ActionManager.hpp:26
void remove(EntityActionID actionID, AbstractActionHandler &actionHandler)
Adds a new action handler.
EntityActionManager()=default
~EntityActionManager()=default
Action::ReturnType act(Entity entity, const Action &action)
Dispatches an action to a handler.
EntityActionManager(const EntityActionManager &)=delete
bool canAct(Entity entity, const Action &action) noexcept
Checks if the action manager has an action handler that can handle the given action.
bool canAct(Entity entity, Args &&... args) noexcept(std::is_nothrow_constructible_v< Action, Args... >)
Checks if the action manager has an action handler that can handle the given action.
HashMap< EntityActionID, Vector< AbstractActionHandler * > > mActionHandlers
The map of action handlers.
Definition ActionManager.hpp:29
EntityActionManager(EntityActionManager &&)=delete
void add(EntityActionID actionID, AbstractActionHandler &actionHandler)
Adds a new action handler.
EntityActionManager & operator=(EntityActionManager &&)=delete
void add(EntityActionHandler< A > &actionHandler)
Adds a new action handler.
Definition ActionManager.hpp:79
EntityActionManager & operator=(const EntityActionManager &)=delete
Action::ReturnType act(Entity entity, Args &&... args)
Dispatches an action to a handler.
void remove(EntityActionHandler< A > &actionHandler)
Removes an existing action handler.
Definition ActionManager.hpp:90
The base entity class.
Definition Entity.hpp:41
Definition Application.hpp:19
unsigned int EntityActionID
A numeric type that represents a action.
Definition Action.hpp:19
std::unordered_map< Key, T, Hash, KeyEqual, ScopedAllocatorAdaptor< StdAllocator< Pair< const Key, T >, RawAllocator > > > HashMap
HashMap is an associative container that contains key-value pairs with unique keys.
Definition Map.hpp:33
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25