Class OrbitState
Combat sub-state that strafes the NPC in a circle around its current target.
[CreateAssetMenu(fileName = "New AI Orbit State", menuName = "FishMMO/Character/NPC/AI/Orbit State", order = 0)]
public class OrbitState : BaseAIState, ICachedObject
- Inheritance
-
ObjectScriptableObjectOrbitState
- 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
Remarks
Enable KeepsCombatTarget on assets of this type — see GetBehindState for why. OrbitDuration bounds the manoeuvre so the NPC returns to attacking instead of circling indefinitely.
Fields
OrbitDuration
Seconds to orbit before returning to the attacking state. 0 orbits until something else interrupts, which for a combat sub-state means never attacking again.
[Tooltip("Seconds to orbit before rejoining the attack. 0 = orbit indefinitely.")]
public float OrbitDuration
Field Value
OrbitRadius
Radius of the orbit around the target.
public float OrbitRadius
Field Value
OrbitSpeed
Speed at which the AI orbits around the target.
public float OrbitSpeed
Field Value
RotationSpeed
Speed at which the AI rotates to face the target.
public float RotationSpeed
Field Value
Methods
Enter(AIController)
Called when entering the Orbit state. Initializes orbit angle and checks for target.
public override void Enter(AIController controller)
Parameters
controllerAIControllerThe AI controller.
Exit(AIController)
Called when exiting the Orbit state. Can be used to stop movement or reset parameters.
public override void Exit(AIController controller)
Parameters
controllerAIControllerThe AI controller.
UpdateState(AIController, float)
Called every frame to update the Orbit state. Handles orbit movement, rotation, and state transitions.
public override void UpdateState(AIController controller, float deltaTime)
Parameters
controllerAIControllerThe AI controller.
deltaTimefloatFrame time.