From e9ea621b93fbb58d9edfca8375918791637bbd52 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 30 Dec 2020 20:59:04 +0800 Subject: +init --- Client/Assembly-CSharp/SpinAnimator.cs | 72 ++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Client/Assembly-CSharp/SpinAnimator.cs (limited to 'Client/Assembly-CSharp/SpinAnimator.cs') diff --git a/Client/Assembly-CSharp/SpinAnimator.cs b/Client/Assembly-CSharp/SpinAnimator.cs new file mode 100644 index 0000000..e3762f2 --- /dev/null +++ b/Client/Assembly-CSharp/SpinAnimator.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections; +using UnityEngine; + +public class SpinAnimator : MonoBehaviour +{ + public float Speed = 60f; + + private SpinAnimator.States curState; + + private enum States + { + Visible, + Invisible, + Spinning, + Pulsing + } + + private void Update() + { + if (this.curState == SpinAnimator.States.Spinning) + { + base.transform.Rotate(0f, 0f, this.Speed * Time.deltaTime); + } + } + + public void Appear() + { + if (this.curState != SpinAnimator.States.Invisible) + { + return; + } + this.curState = SpinAnimator.States.Visible; + base.gameObject.SetActive(true); + base.StopAllCoroutines(); + base.StartCoroutine(Effects.ScaleIn(base.transform, 0f, 1f, 0.125f)); + } + + public void Disappear() + { + if (this.curState == SpinAnimator.States.Invisible) + { + return; + } + this.curState = SpinAnimator.States.Invisible; + base.StopAllCoroutines(); + base.StartCoroutine(this.CoDisappear()); + } + + private IEnumerator CoDisappear() + { + yield return Effects.ScaleIn(base.transform, 1f, 0f, 0.125f); + base.gameObject.SetActive(false); + yield break; + } + + public void StartPulse() + { + if (this.curState == SpinAnimator.States.Pulsing) + { + return; + } + this.curState = SpinAnimator.States.Pulsing; + SpriteRenderer component = base.GetComponent(); + base.StartCoroutine(Effects.CycleColors(component, Color.white, Color.green, 1f, float.MaxValue)); + } + + internal void Play() + { + this.curState = SpinAnimator.States.Spinning; + } +} -- cgit v1.1-26-g67d0