ControlLocalizer.cs 667 B

1234567891011121314151617181920212223242526272829
  1. using Immersal.AR;
  2. using Blue;
  3. using UnityEngine;
  4. public class ControlLocalizer: AbstractController
  5. {
  6. [SerializeField] public XRLocalizer NRLocalizer;
  7. [SerializeField] private float rateTime = 2f;
  8. private float time = 0f;
  9. private bool startLocalizer=false;
  10. private void Awake()
  11. {
  12. this.SubscribeEvent<StartImmersalLocalizerEvent>(e =>
  13. {
  14. startLocalizer = true;
  15. }).UnSubScribeWhenGameObjectDestroyed(gameObject);
  16. }
  17. void Update()
  18. {
  19. time += Time.deltaTime;
  20. if(time > rateTime && startLocalizer)
  21. {
  22. NRLocalizer.Localize();
  23. time= 0;
  24. }
  25. }
  26. }