Classes | Public Member Functions | Properties
RAIN.Core.Agent Class Reference

Agent is the base class for AI. Generally if you are using RAIN you will not want to create instances on your own. However, you may want to use key methods of this class to manipulate your AI. More...

Inheritance diagram for RAIN.Core.Agent:
RAIN.Core.PhysicalEntity

List of all members.

Classes

class  NotAnAgentException
 NotAnAgentException may be thrown if RAIN finds a significant error in the construction of the AI. More...

Public Member Functions

Sensor GetSensor (string sensorName)
void GainInterestIn (string symbol)
 GainInterestIn will add the specified Aspect symbol to the set of objects that can be detected by active Sensors.
void LoseInterestIn (string symbol)
 LoseInterestIn will remove the specified Aspect symbol from the set of objects that can be detected by active Sensors.
void ConcentrateOn (string symbol)
 ConcentrateOn will set the specified Aspect symbol as the only Aspect detected by active Sensors. All other Aspects will be ignored.
void Sense ()
 Sense tells your AI to process information from Sensors at this moment in time. Note that this is not a persistent method. You must call each time you need to update AI memory.
void BeginSense ()
 BeginSense resets sensors to their initial state, preparing them to begin a sensing operation. This method should be called once before subsequent calls to Sense.
void GetObjectWithAspect (string symbol, out GameObject aspectObject)
 GetObjectWithAspect will return a single GameObject that has been detected by sensors that matches the Aspect symbol specified.
void GetAllObjectsWithAspect (string symbol, out GameObject[] aspectObjects)
 GetAllObjectsWithAspect returns an array of game objects that have been detected by sensors that match the Aspect symbol defined.
bool MoveTo (Vector3 position, float deltaTime)
 MoveTo instructs your AI to attempt to move toward a point in space in the best way possible. This includes making use of any pathfinding information associated with the current PathManager attached to your AI. RAIN AI will automatically construct paths using Waypoint or Recast Navigation Graph data if available and will use path following and obstacle avoidance to reach the destination. This method must be called per frame during either an Action or within the Act() method of an AIBehavior.
bool Move (float deltaTime)
 Move will cause the AI to move based on the MoveTarget associated with an attached path manager.
bool LookAt (Vector3 position, float deltaTime)
 LookAt instructs your AI to rotate in place and orient itself to face a point in space. This method must be called per frame during either an Action or within the Act() method of an AIBehavior.
bool Look (float deltaTime)
 Look will cause the AI to look based on the LookTarget associated with an attached path manager.

Properties

string Name [get, set]
 A unique name for your AI.
GameObject Avatar [get]
 Avatar (property) returns the game object defined as the Avatar for your AI.
Mind Mind [get]
ActionContext actionContext [get]
MoveLookTarget MoveTarget [get, set]
MoveLookTarget LookTarget [get, set]
PathManager PathManager [get]

Detailed Description

Agent is the base class for AI. Generally if you are using RAIN you will not want to create instances on your own. However, you may want to use key methods of this class to manipulate your AI.


Member Function Documentation

BeginSense resets sensors to their initial state, preparing them to begin a sensing operation. This method should be called once before subsequent calls to Sense.

void RAIN.Core.Agent.ConcentrateOn ( string  symbol)

ConcentrateOn will set the specified Aspect symbol as the only Aspect detected by active Sensors. All other Aspects will be ignored.

Parameters:
symbol
void RAIN.Core.Agent.GainInterestIn ( string  symbol)

GainInterestIn will add the specified Aspect symbol to the set of objects that can be detected by active Sensors.

Parameters:
symbolThe name of an Aspect to detect
void RAIN.Core.Agent.GetAllObjectsWithAspect ( string  symbol,
out GameObject[]  aspectObjects 
)

GetAllObjectsWithAspect returns an array of game objects that have been detected by sensors that match the Aspect symbol defined.

Parameters:
symbolThe name of the Aspect to query
aspectsAn array of GameObjects detected by Sensors related to the Aspect symbol
void RAIN.Core.Agent.GetObjectWithAspect ( string  symbol,
out GameObject  aspectObject 
)

GetObjectWithAspect will return a single GameObject that has been detected by sensors that matches the Aspect symbol specified.

Parameters:
symbolThe name of the Aspect to query
aspectObjectA GameObject that has been detected by Sensors related to the Aspect symbol
bool RAIN.Core.Agent.Look ( float  deltaTime)

Look will cause the AI to look based on the LookTarget associated with an attached path manager.

Parameters:
deltaTime
Returns:
true if the agent is looking at the LookTarget
bool RAIN.Core.Agent.LookAt ( Vector3  position,
float  deltaTime 
)

LookAt instructs your AI to rotate in place and orient itself to face a point in space. This method must be called per frame during either an Action or within the Act() method of an AIBehavior.

Parameters:
positionA Vector3 point to look at
deltaTimeThe time that has passed since the last Update loop
Returns:
true if the agent is looking at the position
void RAIN.Core.Agent.LoseInterestIn ( string  symbol)

LoseInterestIn will remove the specified Aspect symbol from the set of objects that can be detected by active Sensors.

Parameters:
symbolThe name of an Aspect to remove
bool RAIN.Core.Agent.Move ( float  deltaTime)

Move will cause the AI to move based on the MoveTarget associated with an attached path manager.

Parameters:
deltaTime
Returns:
true if the agent has moved to the MoveTarget
bool RAIN.Core.Agent.MoveTo ( Vector3  position,
float  deltaTime 
)

MoveTo instructs your AI to attempt to move toward a point in space in the best way possible. This includes making use of any pathfinding information associated with the current PathManager attached to your AI. RAIN AI will automatically construct paths using Waypoint or Recast Navigation Graph data if available and will use path following and obstacle avoidance to reach the destination. This method must be called per frame during either an Action or within the Act() method of an AIBehavior.

Parameters:
positionA Vector3 point to move toward
deltaTimeThe time that has passed since the last Update loop
Returns:
true if the agent has moved to position

Sense tells your AI to process information from Sensors at this moment in time. Note that this is not a persistent method. You must call each time you need to update AI memory.


Property Documentation

GameObject RAIN.Core.Agent.Avatar [get]

Avatar (property) returns the game object defined as the Avatar for your AI.

string RAIN.Core.Agent.Name [get, set]

A unique name for your AI.