TestLuJing.cs 650 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class TestLuJing : MonoBehaviour
  5. {
  6. public List<GameObject> list_luJing;
  7. public float interval = 1;
  8. float times = 0;
  9. int Index = 0;
  10. // Update is called once per frame
  11. void Update()
  12. {
  13. times += Time.deltaTime;
  14. if(times>interval)
  15. {
  16. times = 0;
  17. Index = Index % list_luJing.Count;
  18. for (int i = 0; i < list_luJing.Count; i++)
  19. {
  20. list_luJing[i].SetActive(false);
  21. }
  22. list_luJing[Index++].SetActive(true);
  23. }
  24. }
  25. }