CUGL 1.3
Cornell University Game Library
|
#include <CUBehaviorAction.h>
Public Member Functions | |
BehaviorActionDef () | |
Static Public Member Functions | |
static std::shared_ptr< BehaviorActionDef > | alloc () |
Public Attributes | |
std::string | name |
std::function< void()> | start |
std::function< bool(float dt)> | update |
std::function< void()> | terminate |
A reusable definition for BehaviorAction.
This definition format allows us to have a single action definition that is used across mutliple instances. The motivation is the same as the difference between a Body and BodyDef in Box2d.
|
inline |
Creates an uninitialized behavior action definition.
To create a definition for an action, access the attributes directly.
NEVER USE A CONSTRUCTOR WITH NEW. If you want to allocate an object on the heap, use the static constructor instead.
|
inlinestatic |
Returns a newly allocated (uninitialized) behavior action definition.
To create a definition for an action, access the attributes directly.
std::string cugl::ai::BehaviorActionDef::name |
The descriptive, identifying name of the action.
std::function<void()> cugl::ai::BehaviorActionDef::start |
The initialization function to begin running an action.
This function should set up the inital action state for the update function.
std::function<void()> cugl::ai::BehaviorActionDef::terminate |
The terminate function to manage interruptions.
This function is to handle any interruptions that occur before the action has completed. This function should ensure that the actor returns to a stable state when the action is interrupted.
std::function<bool(float dt)> cugl::ai::BehaviorActionDef::update |
The update function processing the action over time.
This returns true if the action is finished and false otherwise. If the function returns true, it is assumed that any necessary clean-up has already happened and no further function calls are necessary.