123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- using SC.XR.Unity;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using XRTool.Util;
- public class SystemFollow : MonoBehaviour {
- //private followCamera followcamera;
- public SCButton resetSlamBtn;
- public SCButton switch3DofBtn;
- public SCButton switch6DofBtn;
- public SCButton switchAR;
- public SCButton switchMR;
- public void InitUI()
- {
- switch3DofBtn.gameObject.SetActive(false);
- switch6DofBtn.gameObject.SetActive(false);
- switchAR.gameObject.SetActive(false);
- switchMR.gameObject.SetActive(false);
- this.gameObject.SetActive(false);
- }
- public void Init()
- {
- this.gameObject.SetActive(true);
- }
- public void ResetPattern()
- {
- if (switchMR.gameObject.activeSelf)
- {
- SwitchMR();
- }
- //if (switch3DofBtn.gameObject.activeSelf)
- //{
- // Swith3DOf();
- //}
- this.gameObject.SetActive(false);
- }
- // Use this for initialization
- void Start ()
- {
- resetSlamBtn.onClick.AddListener(ToResetSlam);
- switch3DofBtn.onClick.AddListener(Swith3DOf);
- switch6DofBtn.onClick.AddListener(Swith6DOf);
- switchAR.onClick.AddListener(SwitchAR);
- switchMR.onClick.AddListener(SwitchMR);
- }
- // Update is called once per frame
- void Update () {
- this.transform.position = OpenXRCamera.Instance.head.position;
- this.transform.eulerAngles = new Vector3 (0, OpenXRCamera.Instance.head.eulerAngles.y,0);
- }
- public void ToResetSlam()
- {
- API_GSXR_Slam.GSXR_Reset_Slam();
- if (ShowRoom.Instance.gameObject.activeSelf)
- {
- ShowRoom.Instance.Reset();
- }
- }
- public void Swith3DOf()
- {
- //API_GSXR_Slam.GSXR_Set_TrackMode(TrackMode.Mode_3Dof);
- switch3DofBtn.gameObject.SetActive(false);
- switch6DofBtn.gameObject.SetActive(true);
- }
- public void Swith6DOf()
- {
- //API_GSXR_Slam.GSXR_Set_TrackMode(TrackMode.Mode_6Dof);
- switch3DofBtn.gameObject.SetActive(true);
- switch6DofBtn.gameObject.SetActive(false);
- //API_GSXR_Slam.GSXR_Reset_Slam();
- }
- private void SwitchAR()
- {
- switchAR.gameObject.SetActive(false);
- switchMR.gameObject.SetActive(true);
- if (GameStart.Instance)
- {
- GameStart.Instance.gameObject.SetActive(false);
- }
- //if (RemoteRtc.Instance)
- //{
- // RemoteRtc.Instance.meshRender.gameObject.layer = LayerMask.NameToLayer("Default");
- //}
- if (GSXRManager.Instance)
- {
- GSXRManager.Instance.leftCamera.cullingMask = -1;
- GSXRManager.Instance.rightCamera.cullingMask = -1;
- }
- resetSlamBtn.enabled = false;
- switch3DofBtn.enabled = false;
- switch6DofBtn.enabled = false;
- }
- private void SwitchMR()
- {
- switchAR.gameObject.SetActive(true);
- switchMR.gameObject.SetActive(false);
- if (GameStart.Instance)
- {
- GameStart.Instance.gameObject.SetActive(true);
- }
- //if (RemoteRtc.Instance)
- //{
- // RemoteRtc.Instance.meshRender.gameObject.layer = LayerMask.NameToLayer("fouces");
- //}
- if (GSXRManager.Instance)
- {
- GSXRManager.Instance.leftCamera.cullingMask = ~(1 << 9);
- GSXRManager.Instance.rightCamera.cullingMask = ~(1 << 9);
- }
- resetSlamBtn.enabled = true;
- switch3DofBtn.enabled = true;
- switch6DofBtn.enabled = true;
- }
- public void SetBlue(Image image)
- {
- Color color = Color.white;
- color.r = 92 / 255f;
- color.g = 170 / 255f;
- color.b = 248 / 255f;
- color.a = 255f / 255f;
- image.color = color;
- }
- public void SetBlack(Image image)
- {
- image.color = Color.black;
- }
- }
|