Interface IPlan
An interface marking the implementation of a plan.
Namespace: Unity.AI.Planner
Syntax
public interface IPlan
Properties
MaxPlanDepth
The length of the longest sequence of actions within the plan graph starting from the root state.
Declaration
int MaxPlanDepth { get; }
Property Value
Type | Description |
---|---|
Int32 |
RootStateKey
The state key for the root state of the plan.
Declaration
IStateKey RootStateKey { get; }
Property Value
Type | Description |
---|---|
IStateKey |
Size
The number of states in the plan.
Declaration
int Size { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
GetActions(IStateKey, IList<IActionKey>)
Populates a list of action keys for a given state key.
Declaration
int GetActions(IStateKey planStateKey, IList<IActionKey> actionKeys)
Parameters
Type | Name | Description |
---|---|---|
IStateKey | planStateKey | The key for the state |
IList<IActionKey> | actionKeys | A list of action key to be populated |
Returns
Type | Description |
---|---|
Int32 | Returns the number of action keys |
GetResultingStates(IStateKey, IActionKey, IList<IStateKey>)
Returns a list of potential states resulting from taking an action in a given state.
Declaration
int GetResultingStates(IStateKey planStateKey, IActionKey actionKey, IList<IStateKey> resultingPlanStateKeys)
Parameters
Type | Name | Description |
---|---|---|
IStateKey | planStateKey | The key of the state in which the action is taken |
IActionKey | actionKey | The key of the action taken |
IList<IStateKey> | resultingPlanStateKeys | A list of resulting state keys to be populated |
Returns
Type | Description |
---|---|
Int32 | Returns a list of potential states resulting from taking an action in a given state. |
GetStateData(IStateKey)
Returns the state data for the current state of the plan.
Declaration
IStateData GetStateData(IStateKey stateKey)
Parameters
Type | Name | Description |
---|---|---|
IStateKey | stateKey | The key of the state for which state data is requested. |
Returns
Type | Description |
---|---|
IStateData | Returns the state data for the current state of the plan. |
IsTerminal(IStateKey)
Returns true if the state meets plan termination conditions or has no valid actions. Returns false otherwise.
Declaration
bool IsTerminal(IStateKey planStateKey)
Parameters
Type | Name | Description |
---|---|---|
IStateKey | planStateKey | The key of the plan state to evaluate. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the state meets plan termination conditions or has no valid actions. Returns false otherwise. |
TryGetActionInfo(IStateKey, IActionKey, out ActionInfo)
Returns the plan information for a given state and action.
Declaration
bool TryGetActionInfo(IStateKey planStateKey, IActionKey actionKey, out ActionInfo actionInfo)
Parameters
Type | Name | Description |
---|---|---|
IStateKey | planStateKey | The key for the state |
IActionKey | actionKey | The key for action |
ActionInfo | actionInfo | The action information for the plan for a given state/action |
Returns
Type | Description |
---|---|
Boolean | Returns true if plan information given state and action was found. |
TryGetEquivalentPlanState(IStateKey, out IStateKey)
Given an input state, will return true if an equivalent plan state is contained within the plan, outputting the corresponding plan state key. Returns false otherwise.
Declaration
bool TryGetEquivalentPlanState(IStateKey stateKey, out IStateKey matchingPlanStateKey)
Parameters
Type | Name | Description |
---|---|---|
IStateKey | stateKey | The state for which an equivalent plan state is sought. |
IStateKey | matchingPlanStateKey | The state key for the plan state equivalent to stateKey. |
Returns
Type | Description |
---|---|
Boolean | Returns true if an equivalent plan state is contained within the plan and false otherwise. |
TryGetOptimalAction(IStateKey, out IActionKey)
Returns the action key for the optimal action for a given state.
Declaration
bool TryGetOptimalAction(IStateKey planStateKey, out IActionKey actionKey)
Parameters
Type | Name | Description |
---|---|---|
IStateKey | planStateKey | The key for the state |
IActionKey | actionKey | The optimal action key |
Returns
Type | Description |
---|---|
Boolean | Returns the action key for the optimal action for a given state |
TryGetStateInfo(IStateKey, out StateInfo)
Returns the plan information for a given state key.
Declaration
bool TryGetStateInfo(IStateKey planStateKey, out StateInfo stateInfo)
Parameters
Type | Name | Description |
---|---|---|
IStateKey | planStateKey | The key for the state |
StateInfo | stateInfo | The state info for the state key |
Returns
Type | Description |
---|---|
Boolean | Returns true if the given state was found |
TryGetStateTransitionInfo(IStateKey, IActionKey, IStateKey, out StateTransitionInfo)
Returns the plan information for a given state transition.
Declaration
bool TryGetStateTransitionInfo(IStateKey originatingPlanStateKey, IActionKey actionKey, IStateKey resultingPlanStateKey, out StateTransitionInfo stateTransitionInfo)
Parameters
Type | Name | Description |
---|---|---|
IStateKey | originatingPlanStateKey | The key of the originating state |
IActionKey | actionKey | The key of the action |
IStateKey | resultingPlanStateKey | The key of the resulting state |
StateTransitionInfo | stateTransitionInfo | The state transition info |
Returns
Type | Description |
---|---|
Boolean | Returns true if a given state transition was found |