Beispiel #1
0
    // ========================================================================

    // Start is called before the first frame update
    void Start()
    {
        //TestSerialization();

        viveControllerInputManager = FindObjectOfType <ViveControllerInputManager>();
        if (viveControllerInputManager == null)
        {
            Debug.LogError("SessionManager: viveControllerInputManager cannot be null");
        }

        if (holoHeadset == null)
        {
            Debug.LogError("SessionManager: holoHeadset cannot be null");
        }

        if (viveHeadset == null)
        {
            Debug.LogError("SessionManager: viveHeadset cannot be null");
        }
    }
    private void InitTrackableObjects()
    {
        try
        {
            {
                GameObject go = GameObject.Find("WorldAnchorInverter");
                if (go != null)
                {
                    worldAnchorInverter = go.GetComponent <WorldAnchorInverter>();
                }
            }

            {
                GameObject go = GameObject.Find("ViveControllerInputManager");
                if (go != null)
                {
                    viveControllerInputManager = go.GetComponent <ViveControllerInputManager>();
                }
            }

            {
                GameObject go = GameObject.Find("SessionManager");
                if (go != null)
                {
                    sessionManager = go.GetComponent <SessionManager>();
                }
            }

            {
                GameObject go = GameObject.Find("ViveLeftController");
                if (go != null)
                {
                    viveLeftController = go.GetComponent <NetworkTransform>();
                }
            }

            {
                GameObject go = GameObject.Find("ViveRightController");
                if (go != null)
                {
                    viveRightController = go.GetComponent <NetworkTransform>();
                }
            }

            {
                GameObject go = GameObject.Find("ViveHeadset");
                if (go != null)
                {
                    viveHeadset = go.GetComponent <NetworkTransform>();
                }
            }

            {
                GameObject go = GameObject.Find("HoloHeadset");
                if (go != null)
                {
                    holoHeadset = go.GetComponent <NetworkTransform>();
                }
            }

            bool ok = true;

            if (viveControllerInputManager == null)
            {
                Debug.LogError("couldn't find viveControllerInputManager");
                ok = false;
            }

            if (viveLeftController == null)
            {
                Debug.LogError("couldn't find viveLeftController");
                ok = false;
            }

            if (viveRightController == null)
            {
                Debug.LogError("couldn't find viveRightController");
                ok = false;
            }

            if (viveHeadset == null)
            {
                Debug.LogError("couldn't find viveHeadset");
                ok = false;
            }

            if (holoHeadset == null)
            {
                Debug.LogError("couldn't find holoHeadset");
                ok = false;
            }

            initedTrackableObjects = ok;
        }
        catch (Exception e)
        {
            PlayerLogInfo = e.Message + "\n" + e.Source + "\n" + e.StackTrace;
            Debug.LogError(e.Message + "\n" + e.Source + "\n" + e.StackTrace);
            throw e;
        }
    }