Class WildlifeFleeState
- Namespace
- FishMMO.Server.Implementation.World.SceneServer.AI
- Assembly
- FishMMO.Server.dll
Prey's "attacking" state: it never attacks, it runs. Slotted as a prey archetype's AttackingState, so everything that sends an NPC into a fight sends prey into flight instead: being hit (OnThreatReceived), a herd-mate's alarm (the spawner's pack, NPCGroup.AlertGroup) and its own search noticing a threat (WildlifeRules.Notices).
[CreateAssetMenu(fileName = "New Wildlife Flee State", menuName = "FishMMO/Character/NPC/AI/Wildlife Flee State", order = 0)]
public class WildlifeFleeState : BaseAttackingState, ICachedObject
- Inheritance
-
ObjectScriptableObjectWildlifeFleeState
- Implements
- Inherited Members
-
ScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.MemberwiseClone()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
Remarks
It never turns to fight and never gives up because it is cornered or tired: while any threat is within the species' safe distance it keeps running, away from all of them at once (FleeHeading(Vector3, IReadOnlyList<Vector3>, Vector3)), trying other directions when the way is blocked. Only when nothing threatening is in range does it calm down, and it settles where it is (its home moves there) rather than walking back into what it ran from.
Methods
Enter(AIController)
Called when entering the attacking state. Sets agent speed to run.
public override void Enter(AIController controller)
Parameters
controllerAIControllerThe AI controller.
PickTarget(AIController, List<ICharacter>)
The nearest threat is the one to watch.
public override void PickTarget(AIController controller, List<ICharacter> targets)
Parameters
controllerAIControllertargetsList<ICharacter>
UpdateState(AIController, float)
Called every AI tick to update the attacking state. Handles death, personality-driven flight, target loss, and attack logic.
public override void UpdateState(AIController controller, float deltaTime)
Parameters
controllerAIControllerThe AI controller.
deltaTimefloatSeconds elapsed since the previous AI tick.