コード例 #1
0
        public ReflectionMethodsCache()
        {
            System.Type[] types  = new System.Type[] { typeof(Ray), typeof(RaycastHit).MakeByRefType(), typeof(float), typeof(int) };
            MethodInfo    method = typeof(Physics).GetMethod("Raycast", types);

            if (method != null)
            {
                this.raycast3D = (Raycast3DCallback)ScriptingUtils.CreateDelegate(typeof(Raycast3DCallback), method);
            }
            System.Type[] typeArray2 = new System.Type[] { typeof(Vector2), typeof(Vector2), typeof(float), typeof(int) };
            MethodInfo    methodInfo = typeof(Physics2D).GetMethod("Raycast", typeArray2);

            if (methodInfo != null)
            {
                this.raycast2D = (Raycast2DCallback)ScriptingUtils.CreateDelegate(typeof(Raycast2DCallback), methodInfo);
            }
            System.Type[] typeArray3 = new System.Type[] { typeof(Ray), typeof(float), typeof(int) };
            MethodInfo    info3      = typeof(Physics).GetMethod("RaycastAll", typeArray3);

            if (info3 != null)
            {
                this.raycast3DAll = (RaycastAllCallback)ScriptingUtils.CreateDelegate(typeof(RaycastAllCallback), info3);
            }
            System.Type[] typeArray4 = new System.Type[] { typeof(Ray), typeof(float), typeof(int) };
            MethodInfo    info4      = typeof(Physics2D).GetMethod("GetRayIntersectionAll", typeArray4);

            if (info4 != null)
            {
                this.getRayIntersectionAll = (GetRayIntersectionAllCallback)ScriptingUtils.CreateDelegate(typeof(GetRayIntersectionAllCallback), info4);
            }
        }
コード例 #2
0
        public ReflectionMethodsCache()
        {
            MethodInfo method = typeof(Physics).GetMethod("Raycast", new Type[]
            {
                typeof(Ray),
                typeof(RaycastHit).MakeByRefType(),
                typeof(float),
                typeof(int)
            });

            if (method != null)
            {
                this.raycast3D = (ReflectionMethodsCache.Raycast3DCallback)ScriptingUtils.CreateDelegate(typeof(ReflectionMethodsCache.Raycast3DCallback), method);
            }
            MethodInfo method2 = typeof(Physics2D).GetMethod("Raycast", new Type[]
            {
                typeof(Vector2),
                typeof(Vector2),
                typeof(float),
                typeof(int)
            });

            if (method2 != null)
            {
                this.raycast2D = (ReflectionMethodsCache.Raycast2DCallback)ScriptingUtils.CreateDelegate(typeof(ReflectionMethodsCache.Raycast2DCallback), method2);
            }
            MethodInfo method3 = typeof(Physics).GetMethod("RaycastAll", new Type[]
            {
                typeof(Ray),
                typeof(float),
                typeof(int)
            });

            if (method3 != null)
            {
                this.raycast3DAll = (ReflectionMethodsCache.RaycastAllCallback)ScriptingUtils.CreateDelegate(typeof(ReflectionMethodsCache.RaycastAllCallback), method3);
            }
            MethodInfo method4 = typeof(Physics2D).GetMethod("GetRayIntersectionAll", new Type[]
            {
                typeof(Ray),
                typeof(float),
                typeof(int)
            });

            if (method4 != null)
            {
                this.getRayIntersectionAll = (ReflectionMethodsCache.GetRayIntersectionAllCallback)ScriptingUtils.CreateDelegate(typeof(ReflectionMethodsCache.GetRayIntersectionAllCallback), method4);
            }
        }