Class CharacterAnimationController
Animates a character's model on every client: a CharacterBody built on the model's CharacterModel, fed what the character is doing.
public class CharacterAnimationController : CharacterBehaviour, ICharacterAnimationController, ICharacterBehaviour, IModelReadyHandler
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourNetworkBehaviourCharacterAnimationController
- Implements
- Inherited Members
-
NetworkBehaviour.IsSpawnedNetworkBehaviour.ComponentIndexNetworkBehaviour.NetworkObjectNetworkBehaviour.MAXIMUM_NETWORKBEHAVIOURSNetworkBehaviour.UNSET_NETWORKBEHAVIOUR_IDNetworkBehaviour.ToString()NetworkBehaviour.Reset()NetworkBehaviour.OnValidate()NetworkBehaviour.IsBehaviourReconcilingNetworkBehaviour.ClearReplicateCache()NetworkBehaviour.RequestReconcileSends()NetworkBehaviour.CreateReconcile()NetworkBehaviour.Reconcile_Reader_Remote<T>(PooledReader, ref T)NetworkBehaviour.ClearBuffedRpcs()NetworkBehaviour.IsClientOnlyNetworkBehaviour.IsServerOnlyNetworkBehaviour.IsHostNetworkBehaviour.IsClientNetworkBehaviour.IsServerNetworkBehaviour.IsDeinitializingNetworkBehaviour.NetworkManagerNetworkBehaviour.ServerManagerNetworkBehaviour.ClientManagerNetworkBehaviour.ObserverManagerNetworkBehaviour.TransportManagerNetworkBehaviour.TimeManagerNetworkBehaviour.SceneManagerNetworkBehaviour.PredictionManagerNetworkBehaviour.RollbackManagerNetworkBehaviour.NetworkObserverNetworkBehaviour.IsClientInitializedNetworkBehaviour.IsClientStartedNetworkBehaviour.IsClientOnlyInitializedNetworkBehaviour.IsClientOnlyStartedNetworkBehaviour.IsServerInitializedNetworkBehaviour.IsServerStartedNetworkBehaviour.IsServerOnlyInitializedNetworkBehaviour.IsServerOnlyStartedNetworkBehaviour.IsHostInitializedNetworkBehaviour.IsHostStartedNetworkBehaviour.IsOfflineNetworkBehaviour.IsNetworkedNetworkBehaviour.GetIsNetworked()NetworkBehaviour.IsManagerReconcilingNetworkBehaviour.ObserversNetworkBehaviour.IsOwnerNetworkBehaviour.IsControllerNetworkBehaviour.HasAuthorityNetworkBehaviour.OwnerNetworkBehaviour.OwnerIdNetworkBehaviour.ObjectIdNetworkBehaviour.LocalConnectionNetworkBehaviour.OwnerMatches(NetworkConnection)NetworkBehaviour.Despawn(GameObject, DespawnType?)NetworkBehaviour.Despawn(NetworkObject, DespawnType?)NetworkBehaviour.Despawn(DespawnType?)NetworkBehaviour.Spawn(GameObject, NetworkConnection, Scene)NetworkBehaviour.Spawn(NetworkObject, NetworkConnection, Scene)NetworkBehaviour.RemoveOwnership()NetworkBehaviour.GiveOwnership(NetworkConnection)NetworkBehaviour.GetInstance<T>()NetworkBehaviour.TryRegisterInstance<T>(T)NetworkBehaviour.UnregisterInstance<T>()NetworkBehaviour.CanLog(LoggingType)NetworkBehaviour.OnStartServerCalledNetworkBehaviour.OnStartClientCalledNetworkBehaviour.WritePayload(NetworkConnection, Writer)NetworkBehaviour.ReadPayload(NetworkConnection, Reader)NetworkBehaviour.OnStartNetwork()NetworkBehaviour.OnStopNetwork()NetworkBehaviour.OnStartServer()NetworkBehaviour.OnStopServer()NetworkBehaviour.OnOwnershipServer(NetworkConnection)NetworkBehaviour.OnSpawnServer(NetworkConnection)NetworkBehaviour.OnDespawnServer(NetworkConnection)NetworkBehaviour.OnStartClient()NetworkBehaviour.OnStopClient()NetworkBehaviour.OnOwnershipClient(NetworkConnection)MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.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.nameObject.hideFlags
Remarks
Who tells it what. The character this client owns is told by its own movement (KCCController calls SetGrounded(bool), SetCrouching(bool), SetSwimming(bool, float), SetClimbing(bool, float) each tick) and its own abilities (TriggerAttack(), TriggerCast(), …). Everyone else's movement never runs here: another player is placed by its NetworkTransform (state forwarding is off) and an NPC moves on the server alone. So a character nothing has told anything lately is read from what this client can see (ObservedMotion: the ground under it, the water round it, the climbable it is on), its casts and attacks come from the cast broadcast every observer already receives (AnimateObservedCast(CharacterCastBroadcast, bool)), and its death from the death broadcast (TriggerDeath()). Nothing extra goes on the wire.
The speed is always seen, never told: every body measures how far its model really went each frame, so the feet match the ground under prediction smoothing and interpolation alike.
Client only: a dedicated server compiles none of it (the setters are empty there).
Methods
OnModelReady()
Called when the character model has finished loading. At this point, the skeleton, Animator, and body region renderers are available.
public void OnModelReady()
OnStartCharacter()
Attempts initial discovery. May fail if model isn't loaded. OnModelReady() provides the guaranteed re-acquisition.
public override void OnStartCharacter()
ResetDeath()
Resets the death animation state and restores default locomotion params. Called on resurrection or when death was mispredicted (reconcile correction). Resets Death trigger, clears Speed to 0, restores Grounded/Crouching defaults, and clears any lingering Attack/Cast/Roll/Jump/Block state.
public void ResetDeath()
ResetState(bool)
Drops the body before the object returns to the pool: its model is destroyed and replaced on the next spawn.
public override void ResetState(bool asServer)
Parameters
asServerboolTrue if called on the server.
SetBlocking(bool)
Sets the blocking state.
public void SetBlocking(bool blocking)
Parameters
blockingbool
SetClimbing(bool, float)
Sets whether the character is climbing a ladder, rope ladder or rope, and how fast: rate is
the climb's speed as a share of the stock climbing speed, positive up and negative down (zero holding still).
public void SetClimbing(bool climbing, float rate)
Parameters
Remarks
The rate is the body's own business: the climb is stepped by the height it sees climbed.
SetCrouching(bool)
Sets whether the character is crouching.
public void SetCrouching(bool crouching)
Parameters
crouchingbool
SetFaded(bool)
Draws the model half see-through (FishMMO.Shared.CharacterFade) while the character is hidden by /gm invis, or
solid again. Told by the server's movement-mode broadcast, which only the owner and staff receive while it is hidden,
and repeated every few seconds, so equipment put on since is faded at the next telling.
public void SetFaded(bool value)
Parameters
valuebool
SetGrounded(bool)
Sets whether the character is on the ground.
public void SetGrounded(bool grounded)
Parameters
groundedbool
SetObservedMovementMode(byte)
An observed character's movement mode as the server tells it (MovementModeBits). Used instead of guessing it from where the body is; until it is told, the guess stands.
public void SetObservedMovementMode(byte mode)
Parameters
modebyte
SetRootMotion(bool)
Enables or disables root motion on the Animator.
public void SetRootMotion(bool enabled)
Parameters
enabledbool
Remarks
Not used: every clip is played in place and the movement moves the character.
SetSpeed(float)
The movement's speed band (0 idle, 0.3 crouch-walk, 0.5 walk, 1 run, 1.5 sprint). An implementation may measure the body's real speed instead, as the game's does.
public void SetSpeed(float speed)
Parameters
speedfloat
Remarks
Not used: the body measures how far its model really goes, which every peer can see.
SetSwimming(bool, float)
Sets whether the character is swimming, and how it lies in the water: pitch degrees, positive
nose down (diving), negative nose up.
public void SetSwimming(bool swimming, float pitch)
Parameters
Remarks
The pitch is the body's own business: it lies along the swim it can see (SwimPose).
TriggerAttack()
Triggers an attack animation.
public void TriggerAttack()
TriggerCast()
Triggers a spell cast animation.
public void TriggerCast()
TriggerDeath()
Triggers the death animation and suppresses all other animation state.
public void TriggerDeath()
Remarks
Death takes everything else's place: the body falls and lies, its guard and its actions dropped.
TriggerJump()
Triggers a jump animation.
public void TriggerJump()
Remarks
Not used: a body in the air rises, tops out and falls by its own vertical speed.
TriggerRoll()
Triggers a roll/dodge animation.
public void TriggerRoll()