diff options
Diffstat (limited to 'Client/Assembly-CSharp/PowerTools/WaitForAnimationFinish.cs')
-rw-r--r-- | Client/Assembly-CSharp/PowerTools/WaitForAnimationFinish.cs | 55 |
1 files changed, 55 insertions, 0 deletions
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); + } + } +} |