MoveCircle.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using CIS;
  3. using UnityEngine;
  4. public class MoveCircle : MonoBehaviour
  5. {
  6. private void Awake()
  7. {
  8. this.myTrans = base.transform;
  9. }
  10. private void Update()
  11. {
  12. if (this.emmit)
  13. {
  14. this.centerTrans.Rotate(0f, 0f, this.speed * SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime);
  15. this.rotateTimer += SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime;
  16. if (this.rotateTimer >= this.rotateTime)
  17. {
  18. this.emmit = false;
  19. this.rotateTimer = 0f;
  20. this.centerTrans.rotation = Quaternion.Euler(0f, 0f, this.endDegree);
  21. }
  22. }
  23. }
  24. public void Emmit(float startDegree, float endDegree, float duration)
  25. {
  26. this.emmit = true;
  27. this.speed = Mathf.Abs(endDegree - startDegree) / duration;
  28. this.rotateTime = duration;
  29. this.endDegree = endDegree;
  30. this.centerTrans.rotation = Quaternion.Euler(0f, 0f, startDegree);
  31. }
  32. public Transform centerTrans;
  33. private Transform myTrans;
  34. private float radius;
  35. private bool emmit;
  36. private float rotateTime;
  37. private float rotateTimer;
  38. private float endDegree;
  39. private float speed;
  40. }