Class Agent
The brain of the Utility AI. It controls the states and uses the UtilityPlanner to find the best action.
Assembly: UtilityAIFramework.dll
Syntax
public class Agent : MonoBehaviour
Fields
Actions
Declaration
public List<IUtilityAction> Actions
Field Value
Events
Declaration
public Agent.AgentEvents Events
Field Value
MoveSystem
Declaration
public MoveSystemBase MoveSystem
Field Value
PauseRoutine
Declaration
public Coroutine PauseRoutine
Field Value
Type |
Description |
Coroutine |
|
PropertySet
Declaration
public PropertySetRuntime PropertySet
Field Value
State
Declaration
Field Value
StateNames
Declaration
public Dictionary<EAgentState, string> StateNames
Field Value
UtilityPlanner
Declaration
public UtilityPlanner UtilityPlanner
Field Value
Properties
Context
Declaration
public IAgentDataContext Context { get; }
Property Value
CurrentAction
Declaration
public IUtilityAction CurrentAction { get; }
Property Value
Methods
AbortPlan()
Declaration
AddAction(UtilityAction)
Add and set up the action.
Declaration
public void AddAction(UtilityAction utilityAction)
Parameters
Awake()
Declaration
protected virtual void Awake()
ExecutePlan()
Declaration
public void ExecutePlan()
FindPlan()
Find a plan and returns true if it exists.
Declaration
Returns
FixedUpdate()
Declaration
protected virtual void FixedUpdate()
GetContext<T>()
Declaration
public T GetContext<T>()
where T : IAgentDataContext
Returns
Type Parameters
GoToState(EAgentState)
Declaration
public void GoToState(EAgentState state)
Parameters
Initialize()
Declaration
public virtual void Initialize()
IsCurrentActionValid()
Is the current action valid to use?
Declaration
public virtual bool IsCurrentActionValid()
Returns
LateUpdate()
Declaration
protected virtual void LateUpdate()
PauseFor(Single, EAgentState, Action)
Set UtilityPlanner pause to true and transition to idle for duration and then transition to planning.
Declaration
public virtual Coroutine PauseFor(float duration, EAgentState postState = EAgentState.Plan, Action postAction = null)
Parameters
Returns
Type |
Description |
Coroutine |
|
Declaration
public virtual void Perform()
ReplaceActions(List<IUtilityAction>)
Declaration
public void ReplaceActions(List<IUtilityAction> actions)
Parameters
ResetCurrentAction()
Declaration
public void ResetCurrentAction()
SearchForActionsInParent()
Searches for actions available on the Agent.
Declaration
public virtual void SearchForActionsInParent()
SetupAction(IUtilityAction)
Declaration
public virtual void SetupAction(IUtilityAction utilityAction)
Parameters
SetupActions()
Declaration
public virtual void SetupActions()
StartPlan()
Declaration
protected virtual Coroutine StartPlan()
Returns
Type |
Description |
Coroutine |
|
Update()
Declaration
protected virtual void Update()
Extension Methods