Class ReturnHomeState
AI State for returning the NPC to its home position. Handles healing and movement speed adjustments.
[CreateAssetMenu(fileName = "New AI ReturnHome State", menuName = "FishMMO/Character/NPC/AI/ReturnHome State", order = 0)]
public class ReturnHomeState : BaseAIState, ICachedObject
- Inheritance
-
ObjectScriptableObjectReturnHomeState
- Implements
- Inherited Members
-
ScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Fields
CompleteHealOnReturn
If true, the NPC will be fully healed upon returning home.
public bool CompleteHealOnReturn
Field Value
HomeArrivalRadius
How close to home counts as home. Also the fallback scatter radius when home itself cannot be sampled onto the NavMesh.
[Tooltip("Distance from home that counts as arriving.")]
public float HomeArrivalRadius
Field Value
Methods
Enter(AIController)
Called when the state is entered. Sets the NPC's destination to home, increases speed, and heals if applicable.
public override void Enter(AIController controller)
Parameters
controllerAIControllerThe AI controller managing this NPC.
Exit(AIController)
Called when the state is exited. Resets movement speed and optionally disables immortality.
public override void Exit(AIController controller)
Parameters
controllerAIControllerThe AI controller managing this NPC.
UpdateState(AIController, float)
Called every frame while in this state. Checks if the NPC has reached its home destination and transitions to random movement.
public override void UpdateState(AIController controller, float deltaTime)
Parameters
controllerAIControllerThe AI controller managing this NPC.
deltaTimefloatTime since last update.