Beispiel #1
0
    // Token: 0x06000042 RID: 66 RVA: 0x00003568 File Offset: 0x00001768
    public void Collapse()
    {
        base.transform.parent = null;
        while (this.head.childCount > 0)
        {
            this.head.GetChild(0).parent = base.transform;
        }
        global::UnityEngine.GUILayer component = this.head.GetComponent <global::UnityEngine.GUILayer>();
        bool flag = component != null;

        if (flag)
        {
            global::UnityEngine.Object.DestroyImmediate(component);
            base.gameObject.AddComponent <global::UnityEngine.GUILayer>();
        }
        bool flag2 = this.ears != null;

        if (flag2)
        {
            while (this.ears.childCount > 0)
            {
                this.ears.GetChild(0).parent = base.transform;
            }
            global::UnityEngine.Object.DestroyImmediate(this.ears.gameObject);
            this._ears = null;
            base.gameObject.AddComponent(typeof(global::UnityEngine.AudioListener));
        }
        bool flag3 = this.origin != null;

        if (flag3)
        {
            bool flag4 = this.origin.name.EndsWith(" (origin)");
            if (flag4)
            {
                global::UnityEngine.Transform origin = this.origin;
                while (origin.childCount > 0)
                {
                    origin.GetChild(0).parent = origin.parent;
                }
                global::UnityEngine.Object.DestroyImmediate(origin.gameObject);
            }
            else
            {
                base.transform.parent = this.origin;
            }
        }
        global::UnityEngine.Object.DestroyImmediate(this.head.gameObject);
        this._head = null;
        bool flag5 = base.name.EndsWith(" (eye)");

        if (flag5)
        {
            base.name = base.name.Substring(0, base.name.Length - " (eye)".Length);
        }
    }
Beispiel #2
0
    // Token: 0x06000041 RID: 65 RVA: 0x00003254 File Offset: 0x00001454
    public void Expand()
    {
        global::UnityEngine.Transform transform = base.transform.parent;
        bool flag = transform == null;

        if (flag)
        {
            transform = new global::UnityEngine.GameObject(base.name + " (origin)").transform;
            transform.localPosition = base.transform.localPosition;
            transform.localRotation = base.transform.localRotation;
            transform.localScale    = base.transform.localScale;
        }
        bool flag2 = this.head == null;

        if (flag2)
        {
            this._head = new global::UnityEngine.GameObject(base.name + " (head)", new global::System.Type[]
            {
                typeof(global::SteamVR_GameView),
                typeof(global::SteamVR_TrackedObject)
            }).transform;
            this.head.parent     = transform;
            this.head.position   = base.transform.position;
            this.head.rotation   = base.transform.rotation;
            this.head.localScale = global::UnityEngine.Vector3.one;
            this.head.tag        = base.tag;
            global::UnityEngine.Camera component = this.head.GetComponent <global::UnityEngine.Camera>();
            component.clearFlags          = 4;
            component.cullingMask         = 0;
            component.eventMask           = 0;
            component.orthographic        = true;
            component.orthographicSize    = 1f;
            component.nearClipPlane       = 0f;
            component.farClipPlane        = 1f;
            component.useOcclusionCulling = false;
        }
        bool flag3 = base.transform.parent != this.head;

        if (flag3)
        {
            base.transform.parent        = this.head;
            base.transform.localPosition = global::UnityEngine.Vector3.zero;
            base.transform.localRotation = global::UnityEngine.Quaternion.identity;
            base.transform.localScale    = global::UnityEngine.Vector3.one;
            while (base.transform.childCount > 0)
            {
                base.transform.GetChild(0).parent = this.head;
            }
            global::UnityEngine.GUILayer component2 = base.GetComponent <global::UnityEngine.GUILayer>();
            bool flag4 = component2 != null;
            if (flag4)
            {
                global::UnityEngine.Object.DestroyImmediate(component2);
                this.head.gameObject.AddComponent <global::UnityEngine.GUILayer>();
            }
            global::UnityEngine.AudioListener component3 = base.GetComponent <global::UnityEngine.AudioListener>();
            bool flag5 = component3 != null;
            if (flag5)
            {
                global::UnityEngine.Object.DestroyImmediate(component3);
                this._ears = new global::UnityEngine.GameObject(base.name + " (ears)", new global::System.Type[]
                {
                    typeof(global::SteamVR_Ears)
                }).transform;
                this.ears.parent        = this._head;
                this.ears.localPosition = global::UnityEngine.Vector3.zero;
                this.ears.localRotation = global::UnityEngine.Quaternion.identity;
                this.ears.localScale    = global::UnityEngine.Vector3.one;
            }
        }
        bool flag6 = !base.name.EndsWith(" (eye)");

        if (flag6)
        {
            base.name += " (eye)";
        }
    }