Пример #1
0
    // Token: 0x0600003F RID: 63 RVA: 0x0000301C File Offset: 0x0000121C
    public void ForceLast()
    {
        bool flag = global::SteamVR_Camera.values != null;

        if (flag)
        {
            foreach (object obj in global::SteamVR_Camera.values)
            {
                global::System.Collections.DictionaryEntry dictionaryEntry = (global::System.Collections.DictionaryEntry)obj;
                global::System.Reflection.FieldInfo        fieldInfo       = dictionaryEntry.Key as global::System.Reflection.FieldInfo;
                fieldInfo.SetValue(this, dictionaryEntry.Value);
            }
            global::SteamVR_Camera.values = null;
        }
        else
        {
            global::UnityEngine.Component[] components = base.GetComponents <global::UnityEngine.Component>();
            for (int i = 0; i < components.Length; i++)
            {
                global::SteamVR_Camera steamVR_Camera = components[i] as global::SteamVR_Camera;
                bool flag2 = steamVR_Camera != null && steamVR_Camera != this;
                if (flag2)
                {
                    bool flag3 = steamVR_Camera.flip != null;
                    if (flag3)
                    {
                        global::UnityEngine.Object.DestroyImmediate(steamVR_Camera.flip);
                    }
                    global::UnityEngine.Object.DestroyImmediate(steamVR_Camera);
                }
            }
            components = base.GetComponents <global::UnityEngine.Component>();
            bool flag4 = this != components[components.Length - 1] || this.flip == null;
            if (flag4)
            {
                bool flag5 = this.flip == null;
                if (flag5)
                {
                    this.flip = base.gameObject.AddComponent <global::SteamVR_CameraFlip>();
                }
                global::SteamVR_Camera.values = new global::System.Collections.Hashtable();
                global::System.Reflection.FieldInfo[] fields = base.GetType().GetFields(52);
                foreach (global::System.Reflection.FieldInfo fieldInfo2 in fields)
                {
                    bool flag6 = fieldInfo2.IsPublic || fieldInfo2.IsDefined(typeof(global::UnityEngine.SerializeField), true);
                    if (flag6)
                    {
                        global::SteamVR_Camera.values[fieldInfo2] = fieldInfo2.GetValue(this);
                    }
                }
                global::UnityEngine.GameObject gameObject = base.gameObject;
                global::UnityEngine.Object.DestroyImmediate(this);
                gameObject.AddComponent <global::SteamVR_Camera>().ForceLast();
            }
        }
    }
Пример #2
0
 // Token: 0x060005D1 RID: 1489 RVA: 0x0001C49C File Offset: 0x0001A69C
 public static T CopyComponent <T>(T original, global::UnityEngine.GameObject destination) where T : global::UnityEngine.Component
 {
     global::System.Type                   type      = original.GetType();
     global::UnityEngine.Component         component = destination.AddComponent(type);
     global::System.Reflection.FieldInfo[] fields    = type.GetFields();
     foreach (global::System.Reflection.FieldInfo fieldInfo in fields)
     {
         fieldInfo.SetValue(component, fieldInfo.GetValue(original));
     }
     return(component as T);
 }
        // Token: 0x060005FE RID: 1534 RVA: 0x0001D298 File Offset: 0x0001B498
        public static T CopyComponentFrom <T>(this global::UnityEngine.GameObject destination, T original) where T : global::UnityEngine.Component
        {
            global::System.Type type = original.GetType();
            T t = destination.AddComponent(type) as T;

            global::System.Reflection.FieldInfo[] fields = type.GetFields(20);
            foreach (global::System.Reflection.FieldInfo fieldInfo in fields)
            {
                fieldInfo.SetValue(t, fieldInfo.GetValue(original));
            }
            return(t);
        }
        // Token: 0x060005FD RID: 1533 RVA: 0x0001D230 File Offset: 0x0001B430
        public static U CopyComponentFrom <T, U>(this global::UnityEngine.GameObject destination, T original) where T : global::UnityEngine.Component where U : T
        {
            global::System.Type typeFromHandle = typeof(T);
            U u = destination.AddComponent <U>();

            global::System.Reflection.FieldInfo[] fields = typeFromHandle.GetFields(20);
            foreach (global::System.Reflection.FieldInfo fieldInfo in fields)
            {
                fieldInfo.SetValue(u, fieldInfo.GetValue(original));
            }
            return(u);
        }
Пример #5
0
 // Token: 0x06000577 RID: 1399 RVA: 0x0001B404 File Offset: 0x00019604
 public static global::VRGIN.Helpers.LookTargetController AttachTo(global::VRGIN.Core.IActor actor, global::UnityEngine.GameObject gameObject)
 {
     return(gameObject.AddComponent <global::VRGIN.Helpers.LookTargetController>());
 }