FlyPreloaderController.cs 973 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using System;
  6. public class FlyPreloaderController : MonoBehaviour
  7. {
  8. [SerializeField]
  9. private Text departurePoint;
  10. [SerializeField]
  11. private Text destinationPoint;
  12. [SerializeField]
  13. private Image loadImage;
  14. [SerializeField]
  15. private float rotationSpeed;
  16. private void OnEnable()
  17. {
  18. if (departurePoint == null || destinationPoint == null)
  19. {
  20. gameObject.SetActive(false);
  21. throw new NullReferenceException("Departure or Destination text reference missing!");
  22. }
  23. }
  24. private void Update()
  25. {
  26. if (gameObject.activeInHierarchy)
  27. loadImage.transform.Rotate(Vector3.back, rotationSpeed);
  28. }
  29. public string DeparturePoint
  30. {
  31. get
  32. {
  33. return departurePoint.text;
  34. }
  35. set
  36. {
  37. departurePoint.text = value;
  38. }
  39. }
  40. public string DestinationPoint
  41. {
  42. get
  43. {
  44. return destinationPoint.text;
  45. }
  46. set
  47. {
  48. destinationPoint.text = value;
  49. }
  50. }
  51. }