RAIN.Action.Action Class Reference

The Action class defines the basic functionality of any low-level action. An Action can be Started, Executed, or Stopped. Actions have an ActionName to help identify them during debugging, and an ActionContext that serves as a kind of "blackboard" for transmitting information between actions that are working together. More...

Inheritance diagram for RAIN.Action.Action:
RAIN.Action.ParallelActionExecutor RAIN.Action.SequentialActionExecutor RAIN.Action.TeleoReactiveActionExecutor RAIN.BehaviorTrees.BTNode RAIN.Path.FindPathToTarget RAIN.Path.FollowPath RAIN.Path.MoveToTarget RAIN.Path.NavGridPathChooseMoveTarget RAIN.Path.WaypointPathChooseMoveTarget RAIN.Path.WaypointPathFollower RAIN.Primitives.AnimateAction RAIN.Primitives.AssignVariableAction RAIN.Primitives.DetectAction RAIN.Primitives.MoveAction RAIN.Primitives.PlayAudioAction

List of all members.

Public Types

enum  ActionResult { SUCCESS, FAILURE, RUNNING }
 ActionResult defines Action return status SUCCESS: Finished action successfully RUNNING: Current step successful, more steps required FAILURE: Action failed. More...

Public Member Functions

virtual void SetActionContext (ActionContext context)
 SetActionContext is used to pass a reference to a shared action context. An Action should ensure that its own current state is set/reset based on the new action context. An Action should also usually call SetActionContext on any child actions.
virtual ActionResult Start (Agent agent, float deltaTime)
 Start is called by an Action Executor one time prior to calling consecutive Execute calls.
virtual ActionResult Execute (Agent agent, float deltaTime)
 Execute is called by an Action Executor to perform the work of the Action. An Action can run to completion, but will typically perform only the work for a single timestep, then continue at the next timestep for long running actions.
virtual ActionResult Stop (Agent agent, float deltaTime)
 Stop is called to support cleanup and termination of execution activites. Stop should always be called by the Action Executor after a Start, regardless of the SUCCESS or FAILURE of any Execute calls.

Static Public Member Functions

static Action LoadActionInstance (string actionName)
 LoadActionInstance is a helper method that searches through loaded .NET assemblies for an Action class matching the designated actionName. If the class is found, an instance is created and the action is returned.

Protected Attributes

string actionName = "undefined"
 actionName is used to identify actions. This is primarily used for debugging purposes to see which actions are activated or executing
ActionContext actionContext = null
 actionContext is the ActionContext shared memory for a group of actions working together.

Properties

string ActionName [get]
 Public accessor for actionName, read-only.

Detailed Description

The Action class defines the basic functionality of any low-level action. An Action can be Started, Executed, or Stopped. Actions have an ActionName to help identify them during debugging, and an ActionContext that serves as a kind of "blackboard" for transmitting information between actions that are working together.

Actions are used throughout RAIN in Goal Oriented Behavior, Behavior Trees, and in Primitives for pathfinding, etc. ActionExecutors expect specific semantics from Actions. The Start method is always called before execution and is responsible for setting initialization. The Execute method is called to allow the Action to process in a single timestep/update. The Stop method is always called after execution is complete, regardless of success or failure. Although Start and Stop may return ActionResult.FAILURE, the executor may ignore the values. Execute should return SUCCESS if the action has been completed successfully, RUNNING if the Action processed correctly for the timestep, but more work is still required (e.g., moved toward the target but haven't reached it yet), and FAILURE if the Action could not process correctly.


Member Enumeration Documentation

ActionResult defines Action return status SUCCESS: Finished action successfully RUNNING: Current step successful, more steps required FAILURE: Action failed.


Member Function Documentation

virtual ActionResult RAIN.Action.Action.Execute ( Agent  agent,
float  deltaTime 
) [virtual]

Execute is called by an Action Executor to perform the work of the Action. An Action can run to completion, but will typically perform only the work for a single timestep, then continue at the next timestep for long running actions.

Parameters:
agentThe AI agent owning this action
deltaTimetimestep in seconds
Returns:
Returns SUCCESS if the action completed successfully, FAILURE if a failure occured, RUNNING if more work is to be done

Reimplemented in RAIN.Action.ParallelActionExecutor, RAIN.Action.SequentialActionExecutor, RAIN.Action.TeleoReactiveActionExecutor, RAIN.BehaviorTrees.BTActionNode, RAIN.BehaviorTrees.BTConditionNode, RAIN.BehaviorTrees.BTIteratorNode, RAIN.BehaviorTrees.BTLastStateNode, RAIN.BehaviorTrees.BTParallelNode, RAIN.BehaviorTrees.BTRepeater, RAIN.BehaviorTrees.BTSelectorNode, RAIN.BehaviorTrees.BTSequencerNode, RAIN.GOB.GOBTree.GOBTreeNode, RAIN.Path.FollowPath, RAIN.Path.MoveToTarget, RAIN.Path.NavGridPathChooseMoveTarget, RAIN.Path.FindPathToTarget, RAIN.Path.WaypointPathChooseMoveTarget, RAIN.Path.WaypointPathFollower, RAIN.Primitives.AnimateAction, RAIN.Primitives.AssignVariableAction, RAIN.Primitives.DetectAction, and RAIN.Primitives.MoveAction.

static Action RAIN.Action.Action.LoadActionInstance ( string  actionName) [static]

LoadActionInstance is a helper method that searches through loaded .NET assemblies for an Action class matching the designated actionName. If the class is found, an instance is created and the action is returned.

Parameters:
actionNameThe classname of the Action to load
Returns:
Returns an instance of the actionName class if found, otherwise null
virtual void RAIN.Action.Action.SetActionContext ( ActionContext  context) [virtual]

SetActionContext is used to pass a reference to a shared action context. An Action should ensure that its own current state is set/reset based on the new action context. An Action should also usually call SetActionContext on any child actions.

Parameters:
context

Reimplemented in RAIN.Action.ParallelActionExecutor, RAIN.Action.SequentialActionExecutor, RAIN.Action.TeleoReactiveActionExecutor, RAIN.BehaviorTrees.BTNode, RAIN.Path.FollowPath, and RAIN.Path.WaypointPathFollower.

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

Member Data Documentation

actionContext is the ActionContext shared memory for a group of actions working together.

string RAIN.Action.Action.actionName = "undefined" [protected]

actionName is used to identify actions. This is primarily used for debugging purposes to see which actions are activated or executing


Property Documentation

string RAIN.Action.Action.ActionName [get]

Public accessor for actionName, read-only.