/* * //<public Methods> */ public void TransAnimation(AnimBox anim_box) { if (ConnectProcess(anim_box)) { StartCoroutine(Trans()); } }
private void Awake() { graph = PlayableGraph.Create(); anim = GetComponent <Animator>(); currentAnim = defoultAnim; var output = AnimationPlayableOutput.Create(graph, "output", anim); mixer = AnimationMixerPlayable.Create(graph, 2); output.SetSourcePlayable(mixer); graph.Play(); }
/* * //</public Methods> */ /* * //<private Methods> */ private bool ConnectProcess(AnimBox anim_box) { graph.Disconnect(mixer, 0); graph.Disconnect(mixer, 1); if (prePlayable.IsValid()) { prePlayable.Destroy(); } prePlayable = currentPlayable; currentAnim = anim_box; currentPlayable = AnimationClipPlayable.Create(graph, anim_box.clip); mixer.ConnectInput(1, prePlayable, 0); mixer.ConnectInput(0, currentPlayable, 0); once = false; return(true); }