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