// STATIC CONSTRUCTORS: ------------------------------------------------------------------- public static PlayableStateCharacter Create <TInput0, TOutput>( CharacterState stateAsset, AvatarMask avatarMask, CharacterAnimation character, int layer, double startTime, float fade, float speed, float weight, ref PlayableGraph graph, ref TInput0 input0, ref TOutput output) where TInput0 : struct, IPlayable where TOutput : struct, IPlayable { PlayableStateCharacter state = new PlayableStateCharacter( stateAsset, avatarMask, character, layer, fade, speed, weight ); AnimatorControllerPlayable input1 = AnimatorControllerPlayable.Create( graph, stateAsset.GetRuntimeAnimatorController() ); input1.SetTime(startTime); input1.SetSpeed(speed); state.Setup(ref graph, ref input0, ref input1, ref output); return(state); }
public static PlayableStateCharacter CreateBefore( CharacterState stateAsset, AvatarMask avatarMask, CharacterAnimation character, int layer, double startTime, float fade, float speed, float weight, ref PlayableGraph graph, PlayableBase next) { PlayableStateCharacter state = new PlayableStateCharacter( stateAsset, avatarMask, character, layer, fade, speed, weight ); AnimatorControllerPlayable input1 = AnimatorControllerPlayable.Create( graph, stateAsset.GetRuntimeAnimatorController() ); if (stateAsset.enterClip != null) { float offsetTime = Mathf.Max(0.15f, fade); input1.SetDelay(offsetTime); } input1.SetTime(startTime); input1.SetSpeed(speed); state.Setup(ref graph, ref input1, next); return(state); }
public static PlayableStateCharacter CreateAfter( CharacterState stateAsset, AvatarMask avatarMask, CharacterAnimation character, int layer, double startTime, float fade, float speed, float weight, ref PlayableGraph graph, PlayableBase previous, params PlayableGesture.Parameter[] parameters) { PlayableStateCharacter state = new PlayableStateCharacter( stateAsset, avatarMask, character, layer, fade, speed, weight ); AnimatorControllerPlayable input1 = AnimatorControllerPlayable.Create( graph, stateAsset.GetRuntimeAnimatorController() ); foreach (PlayableGesture.Parameter parameter in parameters) { input1.SetFloat(parameter.id, parameter.value); } if (stateAsset.enterClip != null) { float offsetTime = Mathf.Max(0.15f, fade); input1.SetDelay(offsetTime); } input1.SetTime(startTime); input1.SetSpeed(speed); state.Setup(ref graph, previous, ref input1); return(state); }
public void SetState(CharacterState stateAsset, AvatarMask avatarMask, float weight, float transition, float speed, int layer, params PlayableGesture.Parameter[] parameters) { PlayableState prevPlayable; PlayableState nextPlayable; int insertIndex = this.GetSurroundingStates(layer, out prevPlayable, out nextPlayable ); if (prevPlayable == null && nextPlayable == null) { this.states.Add(PlayableStateCharacter.Create( stateAsset, avatarMask, this, layer, this.runtimeControllerPlayable.GetTime(), transition, speed, weight, ref this.graph, ref this.mixerStatesInput, ref this.mixerStatesOutput, parameters )); } else if (prevPlayable != null) { if (prevPlayable.Layer == layer) { prevPlayable.StretchDuration(transition); } this.states.Insert(insertIndex, PlayableStateCharacter.CreateAfter( stateAsset, avatarMask, this, layer, this.runtimeControllerPlayable.GetTime(), transition, speed, weight, ref this.graph, prevPlayable, parameters )); } else if (nextPlayable != null) { this.states.Insert(insertIndex, PlayableStateCharacter.CreateBefore( stateAsset, avatarMask, this, layer, this.runtimeControllerPlayable.GetTime(), transition, speed, weight, ref this.graph, nextPlayable, parameters )); } }
// STATIC CONSTRUCTORS: ------------------------------------------------------------------- public static PlayableStateCharacter Create <TInput0, TOutput>( CharacterState stateAsset, AvatarMask avatarMask, CharacterAnimation character, int layer, double startTime, float fade, float speed, float weight, ref PlayableGraph graph, ref TInput0 input0, ref TOutput output, params PlayableGesture.Parameter[] parameters) where TInput0 : struct, IPlayable where TOutput : struct, IPlayable { PlayableStateCharacter state = new PlayableStateCharacter( stateAsset, avatarMask, character, layer, fade, speed, weight ); AnimatorControllerPlayable input1 = AnimatorControllerPlayable.Create( graph, stateAsset.GetRuntimeAnimatorController() ); foreach (PlayableGesture.Parameter parameter in parameters) { input1.SetFloat(parameter.id, parameter.value); } // Obsolete :-( // if (stateAsset.enterClip != null) // { // float offsetTime = Mathf.Max(0.15f, fade); // input1.SetDelay(offsetTime); // } input1.SetTime(startTime); input1.SetSpeed(speed); state.Setup(ref graph, ref input0, ref input1, ref output); return(state); }
public static PlayableStateCharacter CreateAfter( CharacterState stateAsset, AvatarMask avatarMask, CharacterAnimation character, int layer, double startTime, float fade, float speed, float weight, ref PlayableGraph graph, PlayableBase previous) { PlayableStateCharacter state = new PlayableStateCharacter( stateAsset, avatarMask, character, layer, fade, speed, weight ); AnimatorControllerPlayable input1 = AnimatorControllerPlayable.Create( graph, stateAsset.GetRuntimeAnimatorController() ); input1.SetTime(startTime); input1.SetSpeed(speed); state.Setup(ref graph, previous, ref input1); return(state); }