ParallelActionExecutor is a basic executor that executes all contained Actions in parallel. Since RAIN{one} is not multi-threaded, Actions are executed in sequence, but each Action will get an opportunity to Execute before control is returned. More...
Classes | |
class | TimeBundle |
Public Member Functions | |
ParallelActionExecutor () | |
Default constructor. | |
override ActionResult | Start (Agent agent, float deltaTime) |
Implementation of Action.Start() Performs initialization. | |
override ActionResult | Execute (Agent agent, float deltaTime) |
Implementation of Action.Execute() Causes each Action to execute if not failed or succeeded. | |
override ActionResult | Stop (Agent agent, float deltaTime) |
Implementation of Action.Stop() Performs cleanup. | |
void | RemovePending (string actionName, bool removeAll) |
Remove any Actions matching actionName that have not yet started execution. | |
void | RemoveCurrent (string actionName, bool removeAll) |
Remove any Actions matching actionName that are executing. | |
void | RemoveCompleted (string actionName, bool removeAll) |
Remove any Actions matching actionName that have completed execution. | |
void | Clear () |
Clear will reset to initial state, clearing all Actions from pending, current, and completed. | |
void | Reset (Agent agent) |
Reset will clear all Actions and reset the ActionContext. | |
void | Reset (Agent agent, ActionContext context) |
Reset will clear all Actions and set the ActionContext to the given context. | |
override void | SetActionContext (ActionContext context) |
SetActionContext removes all completed Actions, sets the internal ActionContext, resets the ActionContext for any pending actions, then unpauses execution. | |
void | AddAction (Action action, float delay) |
Add an action to the pending list of Actions to execute. A delay can be included specifying a time delay between activation/selection of an action and when it can be executed. | |
void | InsertAction (Action action, int sequence) |
Insert an action at the specified position into the pending list of Actions to execute. A delay can be included specifying a time delay between activation/selection of an action and when it can be executed. | |
void | RemoveAction (string actionName) |
Remove an action from the ActionExecutor. This will cause the Action to be Stopped and unloaded if it is currently executing. | |
void | Pause () |
Pause will pause execution until Unpause is called or the ActionContext is reset. | |
void | Unpause (float delay) |
Unpause will cause execution to resume after a Pause call. Execution can be delayed by passing in a positive number value for delay. | |
Public Attributes | |
bool | failOnSingle = true |
If failOnSingle is true, execution will fail if any Action fails. |
ParallelActionExecutor is a basic executor that executes all contained Actions in parallel. Since RAIN{one} is not multi-threaded, Actions are executed in sequence, but each Action will get an opportunity to Execute before control is returned.
RAIN.Action.ParallelActionExecutor.ParallelActionExecutor | ( | ) |
Default constructor.
void RAIN.Action.ParallelActionExecutor.AddAction | ( | Action | action, |
float | delay | ||
) |
Add an action to the pending list of Actions to execute. A delay can be included specifying a time delay between activation/selection of an action and when it can be executed.
action | An Action to add |
delay | A time delay in seconds to wait for before allowing execution of the Action |
Implements RAIN.Action.IActionExecutor.
void RAIN.Action.ParallelActionExecutor.Clear | ( | ) |
Clear will reset to initial state, clearing all Actions from pending, current, and completed.
Implements RAIN.Action.IActionExecutor.
override ActionResult RAIN.Action.ParallelActionExecutor.Execute | ( | Agent | agent, |
float | deltaTime | ||
) | [virtual] |
Implementation of Action.Execute() Causes each Action to execute if not failed or succeeded.
agent | The AI Agent owning this executor |
deltaTime | timestep in seconds |
Reimplemented from RAIN.Action.Action.
void RAIN.Action.ParallelActionExecutor.InsertAction | ( | Action | action, |
int | sequence | ||
) |
Insert an action at the specified position into the pending list of Actions to execute. A delay can be included specifying a time delay between activation/selection of an action and when it can be executed.
action | An Action to insert |
delay | A time delay in seconds to wait for before allowing execution of the Action |
Implements RAIN.Action.IActionExecutor.
void RAIN.Action.ParallelActionExecutor.Pause | ( | ) |
Pause will pause execution until Unpause is called or the ActionContext is reset.
Implements RAIN.Action.IActionExecutor.
void RAIN.Action.ParallelActionExecutor.RemoveAction | ( | string | actionName | ) |
Remove an action from the ActionExecutor. This will cause the Action to be Stopped and unloaded if it is currently executing.
actionName | The name of the Action to remove. If more than one Action is loaded with a matching name, all matches will be removed. |
Implements RAIN.Action.IActionExecutor.
void RAIN.Action.ParallelActionExecutor.RemoveCompleted | ( | string | actionName, |
bool | removeAll | ||
) |
Remove any Actions matching actionName that have completed execution.
actionName | The AI Agent owning this executor |
removeAll | If true, remove all matching Actions, If false, remove only the first match |
void RAIN.Action.ParallelActionExecutor.RemoveCurrent | ( | string | actionName, |
bool | removeAll | ||
) |
Remove any Actions matching actionName that are executing.
actionName | The AI Agent owning this executor |
removeAll | If true, remove all matching Actions, If false, remove only the first match |
void RAIN.Action.ParallelActionExecutor.RemovePending | ( | string | actionName, |
bool | removeAll | ||
) |
Remove any Actions matching actionName that have not yet started execution.
actionName | The AI Agent owning this executor |
removeAll | If true, remove all matching Actions, If false, remove only the first match |
void RAIN.Action.ParallelActionExecutor.Reset | ( | Agent | agent | ) |
Reset will clear all Actions and reset the ActionContext.
agent | The AI Agent owning this executor |
Implements RAIN.Action.IActionExecutor.
void RAIN.Action.ParallelActionExecutor.Reset | ( | Agent | agent, |
ActionContext | context | ||
) |
Reset will clear all Actions and set the ActionContext to the given context.
agent | The AI Agent owning this executor |
context | The context to use after clearing Actions |
Implements RAIN.Action.IActionExecutor.
override void RAIN.Action.ParallelActionExecutor.SetActionContext | ( | ActionContext | context | ) | [virtual] |
SetActionContext removes all completed Actions, sets the internal ActionContext, resets the ActionContext for any pending actions, then unpauses execution.
context | The ActionContext to set |
Reimplemented from RAIN.Action.Action.
override ActionResult RAIN.Action.ParallelActionExecutor.Start | ( | Agent | agent, |
float | deltaTime | ||
) | [virtual] |
Implementation of Action.Start() Performs initialization.
agent | The AI Agent owning this executor |
deltaTime | timestep in seconds |
Reimplemented from RAIN.Action.Action.
override ActionResult RAIN.Action.ParallelActionExecutor.Stop | ( | Agent | agent, |
float | deltaTime | ||
) | [virtual] |
Implementation of Action.Stop() Performs cleanup.
agent | The AI Agent owning this executor |
deltaTime | timestep in seconds |
Reimplemented from RAIN.Action.Action.
void RAIN.Action.ParallelActionExecutor.Unpause | ( | float | delay | ) |
Unpause will cause execution to resume after a Pause call. Execution can be delayed by passing in a positive number value for delay.
delay | The amount of time to wait before resuming execution. |
Implements RAIN.Action.IActionExecutor.
bool RAIN.Action.ParallelActionExecutor.failOnSingle = true |
If failOnSingle is true, execution will fail if any Action fails.