using Immersal.AR;
using UnityEngine;
using Blue;
///
/// 控制Immersal定位
///
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(e=>
{
XRLocalizer = GameObject.Find("ImmersalSDK").GetComponent(); // 获取XRLocalizer
this.enabled = true; // 开启脚本
startLocalizer = true; // 开始定位
}).UnSubScribeWhenGameObjectDestroyed(gameObject);
}
void Update()
{
time += Time.deltaTime;
if(time > rateTime && startLocalizer)
{
XRLocalizer.Localize();
time= 0;
}
}
}