Table of Contents

Class AnimationProxy

Namespace
Ceres.Gameplay.Animations
Assembly
Ceres.Gameplay.dll

Animation proxy can blend multi RuntimeAnimatorController and AnimationClip in hierarchy.

public class AnimationProxy : IDisposable
Inheritance
AnimationProxy
Implements
Inherited Members

Constructors

AnimationProxy(Animator)

public AnimationProxy(Animator animator)

Parameters

animator Animator

Fields

DefaultLayerIndex

Proxy default animation layer index

public const int DefaultLayerIndex = 0

Field Value

int

LayerContexts

public readonly Dictionary<LayerHandle, AnimationProxy.LayerContext> LayerContexts

Field Value

Dictionary<LayerHandle, AnimationProxy.LayerContext>

Properties

Animator

Get bound Animator

public Animator Animator { get; }

Property Value

Animator

ClearAnimatorControllerOnStart

Should proxy clear RuntimeAnimatorController of Animator when completely blend in which can prevent animation artifacts. Set RestoreAnimatorControllerOnStop to true to automatically restore it after stopping

public bool ClearAnimatorControllerOnStart { get; set; }

Property Value

bool

Graph

Get playing UnityEngine.Playables.PlayableGraph

protected PlayableGraph Graph { get; }

Property Value

PlayableGraph

IsBlendIn

Is proxy blend out

protected bool IsBlendIn { get; }

Property Value

bool

IsBlendOut

Is proxy blendout

protected bool IsBlendOut { get; }

Property Value

bool

IsPlaying

Is proxy playing

public bool IsPlaying { get; }

Property Value

bool

RestoreAnimatorControllerOnStop

Should proxy restore RuntimeAnimatorController after stopping

public bool RestoreAnimatorControllerOnStop { get; set; }

Property Value

bool

RootMontage

Get root montage node

protected AnimationProxy.AnimationMontageNode RootMontage { get; }

Property Value

AnimationProxy.AnimationMontageNode

SourceController

public RuntimeAnimatorController SourceController { get; }

Property Value

RuntimeAnimatorController

Methods

AddNotifier(AnimationNotifier, LayerHandle)

public void AddNotifier(AnimationNotifier animationNotifier, LayerHandle layerHandle = default)

Parameters

animationNotifier AnimationNotifier
layerHandle LayerHandle

BlendAnimationClipInternal(AnimationClip, float, LayerHandle)

Load animation clip to the graph in blend mode

protected void BlendAnimationClipInternal(AnimationClip animationClip, float blendInDuration = 0.25, LayerHandle layerHandle = default)

Parameters

animationClip AnimationClip
blendInDuration float
layerHandle LayerHandle

BlendAnimatorInternal(RuntimeAnimatorController, float, LayerHandle)

Load animator to the graph in blend mode

protected void BlendAnimatorInternal(RuntimeAnimatorController animatorController, float blendInDuration = 0.25, LayerHandle layerHandle = default)

Parameters

animatorController RuntimeAnimatorController
blendInDuration float
layerHandle LayerHandle

CreateLayer(ref LayerHandle, LayerDescriptor)

Get or create a new montage layer

public void CreateLayer(ref LayerHandle layerHandle, LayerDescriptor layerDescriptor)

Parameters

layerHandle LayerHandle
layerDescriptor LayerDescriptor

CreateLayer(ref LayerHandle, string, uint, bool, AvatarMask)

Get or create a new montage layer

public void CreateLayer(ref LayerHandle layerHandle, string layerName, uint layerIndex = 0, bool additive = false, AvatarMask avatarMask = null)

Parameters

layerHandle LayerHandle
layerName string
layerIndex uint
additive bool
avatarMask AvatarMask

CreateSequenceBuilder()

Create an AnimationProxy.AnimationSequenceBuilder from this proxy

public AnimationProxy.AnimationSequenceBuilder CreateSequenceBuilder()

Returns

AnimationProxy.AnimationSequenceBuilder

Dispose()

Release animation proxy

public virtual void Dispose()

Flow_AddAnimationNotifier(int, float, LayerHandle, EventDelegate)

[ExecutableFunction]
public AnimationNotifier Flow_AddAnimationNotifier(int layer, float normalizedTime = -1, LayerHandle layerHandle = default, EventDelegate onNotify = null)

Parameters

layer int
normalizedTime float
layerHandle LayerHandle
onNotify EventDelegate

Returns

AnimationNotifier

Flow_CreateMontageLayer(string, uint, bool, AvatarMask)

[ExecutableFunction]
public LayerHandle Flow_CreateMontageLayer(string layerName, uint layerIndex = 0, bool additive = false, AvatarMask avatarMask = null)

Parameters

layerName string
layerIndex uint
additive bool
avatarMask AvatarMask

Returns

LayerHandle

Flow_PlayAnimation(AnimationClip, int, float, float)

[ExecutableFunction]
public void Flow_PlayAnimation(AnimationClip animationClip, int loopCount = 1, float blendInTime = 0.25, float blendOutTime = 0.25)

Parameters

animationClip AnimationClip
loopCount int
blendInTime float
blendOutTime float

Flow_PlayAnimationWithCompleteEvent(AnimationClip, int, float, float, EventDelegate)

[ExecutableFunction]
public void Flow_PlayAnimationWithCompleteEvent(AnimationClip animationClip, int loopCount = 1, float blendInTime = 0.25, float blendOutTime = 0.25, EventDelegate onComplete = null)

Parameters

animationClip AnimationClip
loopCount int
blendInTime float
blendOutTime float
onComplete EventDelegate

Flow_RemoveAnimationNotifier(AnimationNotifier, LayerHandle)

[ExecutableFunction]
public void Flow_RemoveAnimationNotifier(AnimationNotifier notifier, LayerHandle layerHandle = default)

Parameters

notifier AnimationNotifier
layerHandle LayerHandle

Flow_StopAllAnimation()

[ExecutableFunction]
public void Flow_StopAllAnimation()

Flow_StopAnimation(AnimationClip)

[ExecutableFunction]
public void Flow_StopAnimation(AnimationClip animationClip)

Parameters

animationClip AnimationClip

GetAllLayerContexts()

public AnimationProxy.LayerContext[] GetAllLayerContexts()

Returns

LayerContext[]

GetAnimationClipInstanceProxy(LayerHandle)

Get animation clip instance proxy if leaf montage use AnimationClip

[ExecutableFunction]
public AnimationProxy.AnimationClipInstanceProxy GetAnimationClipInstanceProxy(LayerHandle layerHandle = default)

Parameters

layerHandle LayerHandle

Returns

AnimationProxy.AnimationClipInstanceProxy

GetAnimatorControllerInstanceProxy(LayerHandle)

Get animator controller instance proxy if leaf montage use RuntimeAnimatorController

[ExecutableFunction]
public AnimationProxy.AnimatorControllerInstanceProxy GetAnimatorControllerInstanceProxy(LayerHandle layerHandle = default)

Parameters

layerHandle LayerHandle

Returns

AnimationProxy.AnimatorControllerInstanceProxy

GetEventHandler()

public AnimationProxy.AnimationEventHandler GetEventHandler()

Returns

AnimationProxy.AnimationEventHandler

GetLayerContext(LayerHandle)

public AnimationProxy.LayerContext GetLayerContext(LayerHandle handle)

Parameters

handle LayerHandle

Returns

AnimationProxy.LayerContext

GetLayerIndex(LayerHandle)

public int GetLayerIndex(LayerHandle layerHandle)

Parameters

layerHandle LayerHandle

Returns

int

GetLeafAnimationDuration(LayerHandle, int)

Get proxy leaf animator controller current state or animation clip duration

[ExecutableFunction]
public float GetLeafAnimationDuration(LayerHandle layerHandle = default, int innerLayerIndex = 0)

Parameters

layerHandle LayerHandle

Proxy layer

innerLayerIndex int

Animator layer if leaf montage use animator controller

Returns

float

GetLeafAnimationName(LayerHandle)

Get proxy leaf animator controller name or animation clip name

[ExecutableFunction]
public string GetLeafAnimationName(LayerHandle layerHandle = default)

Parameters

layerHandle LayerHandle

Returns

string

GetLeafAnimationNormalizedTime(LayerHandle, int)

Get proxy leaf animator controller current state or animation clip normalized time

[ExecutableFunction]
public float GetLeafAnimationNormalizedTime(LayerHandle layerHandle = default, int innerLayerIndex = 0)

Parameters

layerHandle LayerHandle

Proxy layer

innerLayerIndex int

Animator layer if leaf montage use animator controller

Returns

float

GetLeafMontage(LayerHandle)

Get leaf montage node

public AnimationProxy.AnimationMontageNode GetLeafMontage(LayerHandle layerHandle = default)

Parameters

layerHandle LayerHandle

Returns

AnimationProxy.AnimationMontageNode

GetLeafMontageRef(LayerHandle)

Get ref leaf montage node

protected ref AnimationProxy.AnimationMontageNode GetLeafMontageRef(LayerHandle layerHandle = default)

Parameters

layerHandle LayerHandle

Returns

AnimationProxy.AnimationMontageNode

GetLeafPlayable(LayerHandle)

Get leaf Playable

public Playable GetLeafPlayable(LayerHandle layerHandle = default)

Parameters

layerHandle LayerHandle

Returns

Playable

GetLeafPlayableRef(LayerHandle)

Get ref leaf Playable

protected ref Playable GetLeafPlayableRef(LayerHandle layerHandle = default)

Parameters

layerHandle LayerHandle

Returns

Playable

Invoke_Flow_AddAnimationNotifier(AnimationProxy, int, float, LayerHandle, EventDelegate)

[ExecutableFunction]
public static AnimationNotifier Invoke_Flow_AddAnimationNotifier(AnimationProxy value, int value, float value, LayerHandle value, EventDelegate value)

Parameters

value AnimationProxy
value int
value float
value LayerHandle
value EventDelegate

Returns

AnimationNotifier

Invoke_Flow_CreateMontageLayer(AnimationProxy, string, uint, bool, AvatarMask)

[ExecutableFunction]
public static LayerHandle Invoke_Flow_CreateMontageLayer(AnimationProxy value, string value, uint value, bool value, AvatarMask value)

Parameters

value AnimationProxy
value string
value uint
value bool
value AvatarMask

Returns

LayerHandle

Invoke_Flow_PlayAnimation(AnimationProxy, AnimationClip, int, float, float)

[ExecutableFunction]
public static void Invoke_Flow_PlayAnimation(AnimationProxy value, AnimationClip value, int value, float value, float value)

Parameters

value AnimationProxy
value AnimationClip
value int
value float
value float

Invoke_Flow_PlayAnimationWithCompleteEvent(AnimationProxy, AnimationClip, int, float, float, EventDelegate)

[ExecutableFunction]
public static void Invoke_Flow_PlayAnimationWithCompleteEvent(AnimationProxy value, AnimationClip value, int value, float value, float value, EventDelegate value)

Parameters

value AnimationProxy
value AnimationClip
value int
value float
value float
value EventDelegate

Invoke_Flow_RemoveAnimationNotifier(AnimationProxy, AnimationNotifier, LayerHandle)

[ExecutableFunction]
public static void Invoke_Flow_RemoveAnimationNotifier(AnimationProxy value, AnimationNotifier value, LayerHandle value)

Parameters

value AnimationProxy
value AnimationNotifier
value LayerHandle

Invoke_Flow_StopAllAnimation(AnimationProxy)

[ExecutableFunction]
public static void Invoke_Flow_StopAllAnimation(AnimationProxy value)

Parameters

value AnimationProxy

Invoke_Flow_StopAnimation(AnimationProxy, AnimationClip)

[ExecutableFunction]
public static void Invoke_Flow_StopAnimation(AnimationProxy value, AnimationClip value)

Parameters

value AnimationProxy
value AnimationClip

Invoke_GetAnimationClipInstanceProxy(AnimationProxy, LayerHandle)

[ExecutableFunction]
public static AnimationProxy.AnimationClipInstanceProxy Invoke_GetAnimationClipInstanceProxy(AnimationProxy value, LayerHandle value)

Parameters

value AnimationProxy
value LayerHandle

Returns

AnimationProxy.AnimationClipInstanceProxy

Invoke_GetAnimatorControllerInstanceProxy(AnimationProxy, LayerHandle)

[ExecutableFunction]
public static AnimationProxy.AnimatorControllerInstanceProxy Invoke_GetAnimatorControllerInstanceProxy(AnimationProxy value, LayerHandle value)

Parameters

value AnimationProxy
value LayerHandle

Returns

AnimationProxy.AnimatorControllerInstanceProxy

Invoke_GetLeafAnimationDuration(AnimationProxy, LayerHandle, int)

[ExecutableFunction]
public static float Invoke_GetLeafAnimationDuration(AnimationProxy value, LayerHandle value, int value)

Parameters

value AnimationProxy
value LayerHandle
value int

Returns

float

Invoke_GetLeafAnimationName(AnimationProxy, LayerHandle)

[ExecutableFunction]
public static string Invoke_GetLeafAnimationName(AnimationProxy value, LayerHandle value)

Parameters

value AnimationProxy
value LayerHandle

Returns

string

Invoke_GetLeafAnimationNormalizedTime(AnimationProxy, LayerHandle, int)

[ExecutableFunction]
public static float Invoke_GetLeafAnimationNormalizedTime(AnimationProxy value, LayerHandle value, int value)

Parameters

value AnimationProxy
value LayerHandle
value int

Returns

float

Invoke_IsFullBodyOverride(AnimationProxy)

[ExecutableFunction]
public static bool Invoke_IsFullBodyOverride(AnimationProxy value)

Parameters

value AnimationProxy

Returns

bool

Invoke_LoadAnimationClip(AnimationProxy, AnimationClip, float, LayerHandle)

[ExecutableFunction]
public static void Invoke_LoadAnimationClip(AnimationProxy value, AnimationClip value, float value, LayerHandle value)

Parameters

value AnimationProxy
value AnimationClip
value float
value LayerHandle

Invoke_LoadAnimator(AnimationProxy, RuntimeAnimatorController, float, LayerHandle)

[ExecutableFunction]
public static void Invoke_LoadAnimator(AnimationProxy value, RuntimeAnimatorController value, float value, LayerHandle value)

Parameters

value AnimationProxy
value RuntimeAnimatorController
value float
value LayerHandle

Invoke_Stop(AnimationProxy, float, bool)

[ExecutableFunction]
public static void Invoke_Stop(AnimationProxy value, float value, bool value)

Parameters

value AnimationProxy
value float
value bool

IsFullBodyOverride()

Whether proxy override full body animation

[ExecutableFunction]
public bool IsFullBodyOverride()

Returns

bool

LoadAnimationClip(AnimationClip, float, LayerHandle)

Start playing animation from new AnimationClip and blend in if blendInDuration greater than 0

[ExecutableFunction]
public void LoadAnimationClip(AnimationClip animationClip, float blendInDuration = 0.25, LayerHandle layerHandle = default)

Parameters

animationClip AnimationClip
blendInDuration float
layerHandle LayerHandle

LoadAnimationClip_Implementation(AnimationClip, float, LayerHandle)

Load animation clip to the graph

protected virtual void LoadAnimationClip_Implementation(AnimationClip animationClip, float blendInDuration = 0.25, LayerHandle layerHandle = default)

Parameters

animationClip AnimationClip
blendInDuration float
layerHandle LayerHandle

LoadAnimator(RuntimeAnimatorController, float, LayerHandle)

Start playing animation from new RuntimeAnimatorController and blend in if blendInDuration greater than 0

[ExecutableFunction]
public void LoadAnimator(RuntimeAnimatorController animatorController, float blendInDuration = 0.25, LayerHandle layerHandle = default)

Parameters

animatorController RuntimeAnimatorController
blendInDuration float
layerHandle LayerHandle

LoadAnimator_Implementation(RuntimeAnimatorController, float, LayerHandle)

Load animator to the graph

protected virtual void LoadAnimator_Implementation(RuntimeAnimatorController animatorController, float blendInDuration = 0.25, LayerHandle layerHandle = default)

Parameters

animatorController RuntimeAnimatorController
blendInDuration float
layerHandle LayerHandle

PlayAnimationClipInternal(AnimationClip, float, LayerHandle)

Load animation clip to the graph in play mode

protected void PlayAnimationClipInternal(AnimationClip animationClip, float blendInDuration = 0.25, LayerHandle layerHandle = default)

Parameters

animationClip AnimationClip
blendInDuration float
layerHandle LayerHandle

PlayAnimatorInternal(RuntimeAnimatorController, float, LayerHandle)

Load animator to the graph in play mode

protected void PlayAnimatorInternal(RuntimeAnimatorController animatorController, float blendInDuration = 0.25, LayerHandle layerHandle = default)

Parameters

animatorController RuntimeAnimatorController
blendInDuration float
layerHandle LayerHandle

PlayInternal(float)

Start play graph and montage

protected void PlayInternal(float blendInDuration)

Parameters

blendInDuration float

RegisterNotifyCallback(EventCallback<AnimationNotifyEvent>)

public void RegisterNotifyCallback(EventCallback<AnimationNotifyEvent> callback)

Parameters

callback EventCallback<AnimationNotifyEvent>

RemoveNotifier(AnimationNotifier, LayerHandle)

public void RemoveNotifier(AnimationNotifier notifier, LayerHandle layerHandle = default)

Parameters

notifier AnimationNotifier
layerHandle LayerHandle

SetInGraph()

Call this function after animation proxy completly blend in

protected virtual void SetInGraph()

SetOutGraph()

Call this function after animation proxy completely blend out

protected virtual void SetOutGraph()

Shrink(AnimationMontageNode, LayerHandle)

Call this function to release not used playables after montage completely blend in

protected virtual void Shrink(AnimationProxy.AnimationMontageNode node, LayerHandle layerHandle)

Parameters

node AnimationProxy.AnimationMontageNode
layerHandle LayerHandle

Stop(float, bool)

Stop animation proxy montage and blend out if blendOutDuration greater than 0

[ExecutableFunction]
public void Stop(float blendOutDuration = 0.25, bool immediately = true)

Parameters

blendOutDuration float
immediately bool

Whether to stop montage immediately when duration is zero

StopAllAnimationSequences()

Stop all running animation sequences created by this proxy

public void StopAllAnimationSequences()

UnregisterNotifyCallback(EventCallback<AnimationNotifyEvent>)

public void UnregisterNotifyCallback(EventCallback<AnimationNotifyEvent> callback)

Parameters

callback EventCallback<AnimationNotifyEvent>