Class State
A state that can be runned in the StateMachine. Can be added to and edited inside StateData.
Use AddStateMenuAttribute and StateTransitionAttribute to define transitions for the state and make it visible to the editor scritps to allow editing in the custom inspector of StateData
Inherited Members
Namespace: LobsterFramework.AI
Assembly: LobsterFramework.dll
Syntax
public abstract class State : ScriptableObject
Fields
| Improve this Doc View SourceStateMachine
Declaration
[HideInInspector]
protected StateMachine StateMachine
Field Value
Type | Description |
---|---|
StateMachine |
Methods
| Improve this Doc View SourceGetComponentReference<T>(int)
Attempts to get the reference of the specified component type from StateMachine. The type of the reference should be one of the required types applied via RequireComponentReferenceAttribute on this state class.
Declaration
protected T GetComponentReference<T>(int index = 0) where T : Component
Parameters
Type | Name | Description |
---|---|---|
int | index | The index to the list of components of the type specified. Use of type safe enum is strongly recommended. |
Returns
Type | Description |
---|---|
T | The component reference stored in StateMachine if it exists, otherwise null |
Type Parameters
Name | Description |
---|---|
T | The type of the component looking for |
Remarks
This is a shorthand call for GetComponentReference<T>(Type, int) via StateMachine
InitializeFields()
Called to initialize references and perform setups
Declaration
protected abstract void InitializeFields()
OnBecomeInactive()
Called to perform clean up operations
Declaration
protected abstract void OnBecomeInactive()
OnEnter()
Called when entering the state
Declaration
protected abstract void OnEnter()
OnExit()
Called when the exiting the state
Declaration
protected abstract void OnExit()
Tick()
Main body of the state logic, will be called every frame during Update event.
Declaration
protected abstract Type Tick()
Returns
Type | Description |
---|---|
Type | The type of the state to transition to, null if not transitioning to any state. |