예제 #1
0
        public static void Initialize()
        {
            if (cameraControllerRedirected)
            {
                return;
            }

            ResetCameraRect();

            cachedFreeCameraField = typeof(CameraController).GetField("m_cachedFreeCamera", BindingFlags.Instance | BindingFlags.NonPublic);

            var cameraController = Object.FindObjectOfType<CameraController>();
            if (cameraController != null)
            {
                cameraControllerRedirect = RedirectionHelper.RedirectCalls(
                    typeof(CameraController).GetMethod("UpdateFreeCamera",
                        BindingFlags.Instance | BindingFlags.NonPublic),
                    typeof(SetCameraRectHelper).GetMethod("UpdateFreeCamera",
                        BindingFlags.Instance | BindingFlags.NonPublic));

                cameraControllerRedirected = true;
            }
        }