1
0

SequenceFrameManager.cs 922 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class SequenceFrameManager : MonoBehaviour
  5. {
  6. public static SequenceFrameManager Instance;
  7. // ==================================================
  8. private void Awake() => Instance = this;
  9. // ==================================================
  10. public void ResetAll()
  11. {
  12. SwitchSequenceFrameAnimation(-1,false);
  13. return;
  14. }
  15. // ==================================================
  16. public List<GameObject> sequenceFrames;
  17. public void SwitchSequenceFrameAnimation(int index, bool isPlay)
  18. {
  19. if (index == -1) // -1全部播放 // 或全部关闭
  20. {
  21. foreach (var item in sequenceFrames)
  22. {
  23. item.GetComponent<SequenceFrameHandler>().SwitchAnimation(isPlay);
  24. }
  25. return;
  26. }
  27. sequenceFrames[index].GetComponent<SequenceFrameHandler>().SwitchAnimation(isPlay);
  28. return;
  29. }
  30. }