Exemple #1
0
 protected virtual void Awake()
 {
     m_FadeUiRoot = uiRoot.GetComponent <Ximmerse.UI.UIFade>();
     //
     XDevicePlugin.Init();
     for (int i = 0, imax = devices.Length; i < imax; ++i)
     {
         devices[i].Awake();
     }
 }
    protected virtual void Start()
    {
        TrackedObject obj = GetComponent <TrackedObject>();

        if (obj != null)
        {
            controller = obj.source;
        }
        if (controller == ControllerType.None)
        {
            m_ControllerInput = ControllerInputManager.instance.GetControllerInput(name);
        }
        else
        {
            m_ControllerInput = ControllerInputManager.instance.GetControllerInput(controller);
        }
        //
        if (PlayerPrefsEx.GetBool("UINotification-OutOfRange.enabled", false))
        {
            uiOutOfRange = PlayerPrefsEx.GetObject("UINotification-OutOfRange-" + controller.ToString(), null) as GameObject;
            if (uiOutOfRange != null)
            {
                Transform uiRoot = VRContext.uiRootVR;
                if (uiRoot != null)
                {
                    GameObject go = Instantiate(uiOutOfRange);
                    Transform  t = go.transform, raw = uiOutOfRange.transform;
                    t.SetParent(uiRoot);
                    t.localPosition  = raw.localPosition;
                    t.localRotation  = raw.localRotation;
                    t.localScale     = raw.localScale;
                    uiOutOfRange     = go;
                    m_FadeOutOfRange = uiOutOfRange.GetComponent <Ximmerse.UI.UIFade>();
                    //
                    if (m_FadeOutOfRange != null)
                    {
                        m_FadeOutOfRange.alpha = 0.0f;
                    }
                    SetUiOutOfRange(false);
                }
            }
        }
    }