|
Inventory Engine v4.2
|
the AI brain is responsible from going from one state to the other based on the defined transitions. More...
Inherits MonoBehaviour.
Public Member Functions | |
| virtual AIAction[] | GetAttachedActions () |
| virtual AIDecision[] | GetAttachedDecisions () |
| virtual void | TransitionToState (string newStateName) |
| Transitions to the specified state, trigger exit and enter states events. | |
| virtual void | ResetBrain () |
| Resets the brain, forcing it to enter its first state. | |
| virtual void | DeleteUnusedActionsAndDecisions () |
| Triggered via the context menu in its inspector (or if you call it directly), this will remove any unused actions and decisions from the brain. | |
Public Attributes | |
| GameObject | Owner |
| the owner of that AI Brain, usually the associated character | |
| List< AIState > | States |
| the collection of states | |
| float | TimeInThisState |
| the time we've spent in the current state | |
| Transform | Target |
| the current target | |
| Vector3 | _lastKnownTargetPosition = Vector3.zero |
| the last known world position of the target | |
| bool | BrainActive = true |
| whether or not this brain is active | |
| bool | ResetBrainOnStart = true |
| bool | ResetBrainOnEnable = false |
| float | ActionsFrequency = 0f |
| the frequency (in seconds) at which to perform actions (lower values : higher frequency, high values : lower frequency but better performance) | |
| float | DecisionFrequency = 0f |
| the frequency (in seconds) at which to evaluate decisions | |
| bool | RandomizeFrequencies = false |
| whether or not to randomize the action and decision frequencies | |
| Vector2 | RandomActionFrequency = new Vector2(0.5f, 1f) |
| the min and max values between which to randomize the action frequency | |
| Vector2 | RandomDecisionFrequency = new Vector2(0.5f, 1f) |
| the min and max values between which to randomize the decision frequency | |
Protected Member Functions | |
| virtual void | OnEnable () |
| virtual void | Awake () |
| On awake we set our brain for all states. | |
| virtual void | Start () |
| On Start we set our first state. | |
| virtual void | Update () |
| Every frame we update our current state. | |
| virtual void | OnExitState () |
| When exiting a state we reset our time counter. | |
| virtual void | InitializeDecisions () |
| Initializes all decisions. | |
| virtual void | InitializeActions () |
| Initializes all actions. | |
| AIState | FindState (string stateName) |
| Returns a state based on the specified state name. | |
| virtual void | StoreLastKnownPosition () |
| Stores the last known position of the target. | |
Protected Attributes | |
| AIDecision[] | _decisions |
| AIAction[] | _actions |
| float | _lastActionsUpdate = 0f |
| float | _lastDecisionsUpdate = 0f |
| AIState | _initialState |
| AIState | _newState |
Properties | |
| virtual AIState | CurrentState [get, protected set] |
| this brain's current state | |
the AI brain is responsible from going from one state to the other based on the defined transitions.
It's basically just a collection of states, and it's where you'll link all the actions, decisions, states and transitions together.
|
protectedvirtual |
On awake we set our brain for all states.
|
virtual |
Triggered via the context menu in its inspector (or if you call it directly), this will remove any unused actions and decisions from the brain.
|
protected |
Returns a state based on the specified state name.
| stateName |
|
virtual |
|
virtual |
|
protectedvirtual |
Initializes all actions.
|
protectedvirtual |
Initializes all decisions.
|
protectedvirtual |
|
protectedvirtual |
When exiting a state we reset our time counter.
|
virtual |
Resets the brain, forcing it to enter its first state.
|
protectedvirtual |
On Start we set our first state.
|
protectedvirtual |
Stores the last known position of the target.
|
virtual |
Transitions to the specified state, trigger exit and enter states events.
| newStateName |
|
protectedvirtual |
Every frame we update our current state.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
| Vector3 MoreMountains.Tools.AIBrain._lastKnownTargetPosition = Vector3.zero |
the last known world position of the target
|
protected |
| float MoreMountains.Tools.AIBrain.ActionsFrequency = 0f |
the frequency (in seconds) at which to perform actions (lower values : higher frequency, high values : lower frequency but better performance)
| bool MoreMountains.Tools.AIBrain.BrainActive = true |
whether or not this brain is active
| float MoreMountains.Tools.AIBrain.DecisionFrequency = 0f |
the frequency (in seconds) at which to evaluate decisions
| GameObject MoreMountains.Tools.AIBrain.Owner |
the owner of that AI Brain, usually the associated character
| Vector2 MoreMountains.Tools.AIBrain.RandomActionFrequency = new Vector2(0.5f, 1f) |
the min and max values between which to randomize the action frequency
| Vector2 MoreMountains.Tools.AIBrain.RandomDecisionFrequency = new Vector2(0.5f, 1f) |
the min and max values between which to randomize the decision frequency
| bool MoreMountains.Tools.AIBrain.RandomizeFrequencies = false |
whether or not to randomize the action and decision frequencies
| bool MoreMountains.Tools.AIBrain.ResetBrainOnEnable = false |
| bool MoreMountains.Tools.AIBrain.ResetBrainOnStart = true |
| List<AIState> MoreMountains.Tools.AIBrain.States |
the collection of states
| Transform MoreMountains.Tools.AIBrain.Target |
the current target
| float MoreMountains.Tools.AIBrain.TimeInThisState |
the time we've spent in the current state
|
getprotected set |
this brain's current state