コード例 #1
0
 public void OnLevelWasLoaded(int level)
 {
     _scene  = null;
     _camera = null;
     _handles.Clear();
     _currentKeyboardHandle = 0;
 }
コード例 #2
0
 public void OnLevelWasInitialized(int level)
 {
     if (level == 3)
     {
         _scene  = GameObject.FindObjectOfType <H_Scene>();
         _camera = Camera.main.GetComponent <IllusionCamera>();
     }
 }
コード例 #3
0
        public static LimbGoalHandle Create(IKSolverLimb solver, IllusionCamera camera)
        {
            var handle = GameObject.CreatePrimitive(PrimitiveType.Sphere).AddComponent <LimbGoalHandle>();

            handle.transform.localScale *= 0.1f;

            handle.camera     = camera;
            handle.constraint = solver;

            return(handle);
        }
コード例 #4
0
        public static TransformHandle Create(Transform target, IllusionCamera camera)
        {
            var handle = GameObject.CreatePrimitive(PrimitiveType.Cube).AddComponent <TransformHandle>();

            handle.transform.localScale *= 0.05f;

            handle.camera = camera;
            handle.target = target;

            return(handle);
        }
コード例 #5
0
        public static ConstraintHandle Create(IKConstraintBend constraint, IllusionCamera camera)
        {
            var handle = GameObject.CreatePrimitive(PrimitiveType.Sphere).AddComponent <ConstraintHandle>();

            handle.transform.localScale *= 0.1f;

            handle.camera     = camera;
            handle.constraint = constraint;

            return(handle);
        }
コード例 #6
0
        public static EffectorHandle Create(IKEffector effector, IllusionCamera camera)
        {
            var handle = GameObject.CreatePrimitive(PrimitiveType.Cube).AddComponent <EffectorHandle>();

            handle.transform.localScale *= 0.1f;

            handle.camera   = camera;
            handle.effector = effector;
            effector.maintainRelativePositionWeight = 1;

            return(handle);
        }
コード例 #7
0
        public void OnLevelWasLoaded(int level)
        {
            m_scene = GameObject.FindObjectOfType <H_Scene>();

            LookType       = LookAtRotator.TYPE.NO;
            HeadLookType   = LookAtRotator.TYPE.NO;
            m_mode         = CameraMode.None;
            illusionCamera = Camera.main.GetComponent <IllusionCamera>();

            var controls = GameObject.FindObjectOfType <H_EditsUIControl>();

            if (controls)
            {
                BuildGUI(controls);
            }
        }
コード例 #8
0
 protected override void OnLevel(int level)
 {
     base.OnLevel(level);
     _IllusionCamera = FindObjectOfType <IllusionCamera>();
 }
コード例 #9
0
 protected override void OnStart()
 {
     base.OnStart();
     _IllusionCamera = FindObjectOfType <IllusionCamera>();
 }
コード例 #10
0
ファイル: CameraHandler.cs プロジェクト: sfcal99/PlayClubVR
 public void OnLevelWasLoaded()
 {
     _Camera = FindObjectOfType <IllusionCamera>();
 }
コード例 #11
0
 protected override void OnStart()
 {
     base.OnStart();
     _IllusionCamera = FindObjectOfType <IllusionCamera>();
     gameObject.AddComponent <ImpersonationHandler>();
 }
コード例 #12
0
        public void Mimic(Camera cam, Camera[] subCameras = null)
        {
            Console.WriteLine("MIMIC: {0}", cam);
            scene = GameObject.FindObjectOfType <Scene>();
            if (cam == null)
            {
                // Create camera from nothing
                ApplyToCameras(ovrCamera =>
                {
                    ovrCamera.nearClipPlane   = Mathf.Clamp(0.01f, 0.001f, 0.01f);
                    ovrCamera.farClipPlane    = Mathf.Clamp(50f, 50f, 200f);
                    ovrCamera.cullingMask     = LayerMask.GetMask(QUAD_LAYER);
                    ovrCamera.backgroundColor = Color.white;
                    ovrCamera.clearFlags      = CameraClearFlags.Skybox;
                });

                transform.parent = null;
                GUI.UpdateGUI(false, false);
                follow = null;
                Base   = transform;
            }
            else
            {
                var effects = cam.GetComponents <MonoBehaviour>().Where(fx => !(fx is IllusionCamera || fx is CameraRenderImageToTex));

                // Copy camera values
                ApplyToCameras(ovrCamera =>
                {
                    ovrCamera.nearClipPlane   = Mathf.Clamp(0.01f, 0.001f, 0.01f);
                    ovrCamera.farClipPlane    = Mathf.Clamp(100f, 50f, 200f);
                    ovrCamera.cullingMask     = cam.camera.cullingMask & ~LayerMask.GetMask("UI");
                    ovrCamera.clearFlags      = CameraClearFlags.Color;
                    ovrCamera.backgroundColor = cam.backgroundColor;
                    ovrCamera.depth           = cam.depth;

                    foreach (var oldEffect in ovrCamera.GetComponents <MonoBehaviour>())
                    {
                        GameObject.DestroyImmediate(oldEffect);
                    }
                    foreach (var newEffect in effects)
                    {
                        ovrCamera.gameObject.AddComponent(newEffect);
                    }

                    //Console.WriteLine("Found effects in {0}: {1} ({2})", cam.name,  string.Join(", ", effects.Select(e => e.GetType().Name).ToArray()), effects.Length);
                    //Console.WriteLine("My effects: " + string.Join(", ", ovrCamera.GetComponents<MonoBehaviour>().Select(e => e.GetType().Name).ToArray()));

                    //Console.WriteLine(ovrCamera.clearFlags);
                    //var skybox = cam.GetComponent<Skybox>();
                    //if (skybox != null)
                    //{
                    //    var ovrSkybox = ovrCamera.gameObject.GetComponent<Skybox>();
                    //    if (ovrSkybox == null) ovrSkybox = ovrSkybox.gameObject.AddComponent<Skybox>();

                    //    ovrSkybox.material = skybox.material;
                    //}
                });

                hscene = GameObject.FindObjectOfType <H_Scene>();

                transform.parent       = null;
                cam.camera.cullingMask = 0;
                GUI.UpdateGUI(true, true);
                follow = cam.transform;
                Base   = follow;
            }

            if (subCameras != null)
            {
                foreach (var subCam in subCameras)
                {
                    CreateSubCamera(subCam);
                }
            }

            illusionCamera = GameObject.FindObjectOfType <IllusionCamera>();

            transform.localPosition = Vector3.zero;
            transform.localRotation = Quaternion.identity;

            SetRotationLock(lockRotation);
        }