12345678910111213141516171819202122232425262728293031323334 |
- using Immersal.AR;
- using UnityEngine;
- using Blue;
- /// <summary>
- /// 控制Immersal定位
- /// </summary>
- public class ImmersalLocalizerController: AbstractController
- {
- [SerializeField] private XRLocalizer XRLocalizer;
- [SerializeField] private float rateTime = 0.5f;
- private float time = 0f;
- private bool startLocalizer=false;
- private void Awake()
- {
- this.RegisterEvent<StartImmersalLocalizerEvent>(e=>
- {
- XRLocalizer = GameObject.Find("ImmersalSDK").GetComponent<XRLocalizer>(); // 获取XRLocalizer
- this.enabled = true; // 开启脚本
- startLocalizer = true; // 开始定位
- }).UnRegisterWhenGameObjectDestroyed(gameObject);
- }
- void Update()
- {
- time += Time.deltaTime;
- if(time > rateTime && startLocalizer && !SetSceneActive.Instance.active)
- {
- //XRLocalizer.Localize();
- time= 0;
- }
- }
- }
|