RAIN.Action.ParallelActionExecutor Class Reference

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...

Inheritance diagram for RAIN.Action.ParallelActionExecutor:
RAIN.Action.Action RAIN.Action.IActionExecutor

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

RAIN.Action.ParallelActionExecutor.ParallelActionExecutor ( )

Default constructor.


Member Function Documentation

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.

Parameters:
actionAn Action to add
delayA 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.

Parameters:
agentThe AI Agent owning this executor
deltaTimetimestep in seconds
Returns:
SUCCESS if all Actions completed successfully, FAILURE if all Actions failed, or RUNNING if more work should be done

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.

Parameters:
actionAn Action to insert
delayA 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.

Parameters:
actionNameThe 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.

Parameters:
actionNameThe AI Agent owning this executor
removeAllIf 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.

Parameters:
actionNameThe AI Agent owning this executor
removeAllIf 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.

Parameters:
actionNameThe AI Agent owning this executor
removeAllIf 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.

Parameters:
agentThe 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.

Parameters:
agentThe AI Agent owning this executor
contextThe 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.

Parameters:
contextThe 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.

Parameters:
agentThe AI Agent owning this executor
deltaTimetimestep in seconds
Returns:
Returns SUCCESS or FAILURE

Reimplemented from RAIN.Action.Action.

override ActionResult RAIN.Action.ParallelActionExecutor.Stop ( Agent  agent,
float  deltaTime 
) [virtual]

Implementation of Action.Stop() Performs cleanup.

Parameters:
agentThe AI Agent owning this executor
deltaTimetimestep in seconds
Returns:
Returns SUCCESS or FAILURE

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.

Parameters:
delayThe amount of time to wait before resuming execution.

Implements RAIN.Action.IActionExecutor.


Member Data Documentation

If failOnSingle is true, execution will fail if any Action fails.