private void Update() { if (affectedByTimescale) { animationMixer.SetSpeed(Time.timeScale); } else { animationMixer.SetSpeed(1); } }
private IEnumerator PlayStartAnimation() { // Trigger an "animationStart" event Camera.main.gameObject.GetComponent <PlayableDirector>().enabled = true; Camera.main.gameObject.GetComponent <PlayableDirector>().Play(); allow_input = false; animationStartEvent(); // Trying to change aniumation speed, not working AnimationMixerPlayable mixer = AnimationMixerPlayable.Create(Camera.main.gameObject.GetComponent <PlayableDirector> ().playableGraph, 1); mixer.SetSpeed(startAnimationSpeed); // When animation is over, trigger an "animationEnd" event while (true) { if (Camera.main.gameObject.GetComponent <PlayableDirector>().state != PlayState.Playing) { allow_input = true; animationEndEvent(); Debug.Log("Animation is Done."); yield break; } yield return(1); } }
public void SetWeight() { float secondClipWeight = 1.0f - firstClipWeight; m_mixerPlayable.SetInputWeight(0, firstClipWeight); m_mixerPlayable.SetInputWeight(1, secondClipWeight); float mixerPlayableSpeed = 1.0f / (firstClipWeight * m_firstClipLength + secondClipWeight * m_secondClipLength); m_mixerPlayable.SetSpeed(mixerPlayableSpeed); }