UpdateManager.cs 779 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class UpdateManager : MonoBehaviour
  5. {
  6. public float time = 60;
  7. public float timea = 5;
  8. // Start is called before the first frame update
  9. void Start()
  10. {
  11. StartCoroutine(updateTime());
  12. StartCoroutine(playAnimation());
  13. }
  14. IEnumerator updateTime()
  15. {
  16. while(true)
  17. {
  18. updateData();
  19. yield return new WaitForSeconds(time);
  20. }
  21. }
  22. IEnumerator playAnimation()
  23. {
  24. while(true)
  25. {
  26. updateAnimation();
  27. yield return new WaitForSeconds(timea);
  28. }
  29. }
  30. public virtual void updateData()
  31. {
  32. }
  33. public virtual void updateAnimation()
  34. {
  35. }
  36. }