DanceIntervalDelete.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using UnityEngine;
  3. public class DanceIntervalDelete : MonoBehaviour
  4. {
  5. public bool IsEnd
  6. {
  7. get
  8. {
  9. return this.m_IsEnd;
  10. }
  11. }
  12. protected virtual void Start()
  13. {
  14. RhythmAction_Mgr.Instance.AddParticleSystem(this.particleArray);
  15. RhythmAction_Mgr.Instance.AddAudioMgr(this.audioArray);
  16. base.StartCoroutine(RhythmAction_Mgr.Instance.DanceTimeCoroutine(this.DeleteTime, new Action<float>(this.UpdataCall), new Action(this.EndCall)));
  17. }
  18. protected virtual void OnDestroy()
  19. {
  20. this.EndCall();
  21. }
  22. protected virtual void UpdataCall(float timer)
  23. {
  24. }
  25. public virtual void EndCall()
  26. {
  27. if (this.m_IsEnd)
  28. {
  29. return;
  30. }
  31. if (RhythmAction_Mgr.Instance)
  32. {
  33. RhythmAction_Mgr.Instance.RemoveParticleSystem(this.particleArray);
  34. RhythmAction_Mgr.Instance.RemoveAudioMgr(this.audioArray);
  35. }
  36. this.m_IsEnd = true;
  37. UnityEngine.Object.Destroy(base.gameObject);
  38. }
  39. public float DeleteTime = 3f;
  40. public ParticleSystem[] particleArray;
  41. public AudioSource[] audioArray;
  42. protected bool m_IsEnd;
  43. }