From e9ea621b93fbb58d9edfca8375918791637bbd52 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 30 Dec 2020 20:59:04 +0800 Subject: +init --- .../PowerTools/WaitForAnimationFinish.cs | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Client/Assembly-CSharp/PowerTools/WaitForAnimationFinish.cs (limited to 'Client/Assembly-CSharp/PowerTools/WaitForAnimationFinish.cs') diff --git a/Client/Assembly-CSharp/PowerTools/WaitForAnimationFinish.cs b/Client/Assembly-CSharp/PowerTools/WaitForAnimationFinish.cs new file mode 100644 index 0000000..f4f083c --- /dev/null +++ b/Client/Assembly-CSharp/PowerTools/WaitForAnimationFinish.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections; +using UnityEngine; + +namespace PowerTools +{ + public class WaitForAnimationFinish : IEnumerator + { + public object Current + { + get + { + return null; + } + } + + private SpriteAnim animator; + + private AnimationClip clip; + + private bool first = true; + + public WaitForAnimationFinish(SpriteAnim animator, AnimationClip clip) + { + this.animator = animator; + this.clip = clip; + this.animator.Play(this.clip, 1f); + } + + public bool MoveNext() + { + if (this.first) + { + this.first = false; + return true; + } + bool result; + try + { + result = this.animator.IsPlaying(this.clip); + } + catch + { + result = false; + } + return result; + } + + public void Reset() + { + this.first = true; + this.animator.Play(this.clip, 1f); + } + } +} -- cgit v1.1-26-g67d0