Exemplo n.º 1
0
        private static void ToMainCamera()
        {
            if (_cam != null)
            {
                _cam.transform.parent        = _origParent;
                _cam.transform.localPosition = _origPosition;
                _cam.transform.localRotation = _origRotation;
                _cam.SetFoV(_origFoV);
                _cam.ActivateUpdate();

                if (FlightGlobals.ActiveVessel != null && HighLogic.LoadedSceneIsFlight)
                {
                    _cam.SetTarget(FlightGlobals.ActiveVessel.transform, FlightCamera.TargetMode.Vessel);
                }

                _origParent = null;
            }

            if (_currentCamera != null)
            {
                _currentCamera.ltCamActive = false;
            }

            _currentCamera            = null;
            Camera.main.nearClipPlane = _origClip;
        }
Exemplo n.º 2
0
        protected static void RestoreMainCamera()
        {
            DebugOutput("RestoreMainCamera");

            sCam.transform.parent        = sOrigParent;
            sCam.transform.localPosition = sOrigPosition;
            sCam.transform.localRotation = sOrigRotation;
            Camera.main.nearClipPlane    = sOrigClip;
            sCurrentCamera.mt.SetCameraMode(CameraFilter.eCameraMode.Normal);
            sCam.SetFoV(sOrigFov);
            sCam.ActivateUpdate();

            if (FlightGlobals.ActiveVessel != null && HighLogic.LoadedScene == GameScenes.FLIGHT)
            {
                //sCam.SetTarget(FlightGlobals.ActiveVessel.transform, FlightCamera.TargetMode.Transform);
                sCam.SetTarget(FlightGlobals.ActiveVessel.transform, FlightCamera.TargetMode.Vessel);
            }

            sOrigParent = null;

            if (sCurrentCamera != null)
            {
                sCurrentCamera.camActive = false;
            }
            sCurrentCamera = null;
        }
Exemplo n.º 3
0
        public void Stop(KerbalInfo kerbalInfo)
        {
            FlightCamera flightCam = FlightCamera.fetch;
            Vessel       vessel    = kerbalInfo.Vessel;
            KerbalEVA    evaInst   = kerbalInfo.EVA;

            foreach (Component component in vessel.transform.GetComponentsInChildren(typeof(Transform), true))
            {
                /*if (component.name.Contains(BeKerbal.Settings.EVA_HelmetColliderComponentName) && _OriginHelmetColliderRadius == -1.0f)
                 * {
                 *  component.GetComponent<SphereCollider>().radius = _OriginHelmetColliderRadius;
                 *  _OriginHelmetColliderRadius = -1.0f;
                 * }*/

                foreach (string name in BeKerbal.Settings.EVA_HiddenComponentsName)
                {
                    if (component.name.Contains(name) && component.renderer != null)
                    {
                        component.renderer.enabled = true;
                        break;
                    }
                }
            }

            flightCam.ActivateUpdate();

            Screen.lockCursor = false;
        }
Exemplo n.º 4
0
        public void disable()
        {
            cam.ActivateUpdate();

            if (oldTarget != null)
            {
                cam.transform.parent = oldTarget;
            }

            active = false;
        }
        protected static void RestoreMainCamera()
        {
            DebugOutput("RestoreMainCamera");

            if (sCam != null)
            {
                sCam.transform.parent        = sOrigParent;
                sCam.transform.localPosition = sOrigPosition;
                sCam.transform.localRotation = sOrigRotation;
                sCam.SetFoV(sOrigFov);
                sCam.ActivateUpdate();

                if (FlightGlobals.ActiveVessel != null && HighLogic.LoadedScene == GameScenes.FLIGHT)
                {
                    //sCam.SetTarget(FlightGlobals.ActiveVessel.transform, FlightCamera.TargetMode.Transform);
                    sCam.SetTarget(FlightGlobals.ActiveVessel.transform, FlightCamera.TargetMode.Vessel);
                }

                sOrigParent = null;
            }
            if (sCurrentCamera != null)
            {
                sCurrentCamera.mt.SetCameraMode(CameraFilter.eCameraMode.Normal);
                sCurrentCamera.camActive = false;
            }
            sCurrentCamera            = null;
            Camera.main.nearClipPlane = sOrigClip;

            /////////////////////////////////////

            if (sOrigVesselTransformPart != null)
            {
                if (GameSettings.MODIFIER_KEY.GetKey(false))
                {
#if false
                    ModuleDockingNode mdn = sOrigVesselTransformPart.FindModuleImplementing <ModuleDockingNode>();
                    if (mdn != null)
                    {
                        sOrigVesselTransformPart.SetReferenceTransform(mdn.controlTransform);
                    }
                    else
#endif
                    {
                        // sOrigVesselTransformPart.SetReferenceTransform(sOrigVesselTransformPart.GetReferenceTransform());
                    }

                    FlightGlobals.ActiveVessel.SetReferenceTransform(sOrigVesselTransformPart, true);
                    ScreenMessages.PostScreenMessage(locControlPointRestored + " " + sOrigVesselTransformPart.partInfo.title);
                    sOrigVesselTransformPart = null;
                }
            }
            /////////////////////////////////////
        }
Exemplo n.º 6
0
        public void resetCamera(Vessel previousVessel)
        {
            ReflectedMembers.Initialize();

            GameObject.Destroy(fpgui);

            if (!isFirstPerson)
            {
                return;
            }

            Vessel       pVessel   = FlightGlobals.ActiveVessel;
            FlightCamera flightCam = FlightCamera.fetch;

            cameraState.recallState(flightCam);

            if (FlightGlobals.ActiveVessel != null)
            {
                flightCam.SetTargetTransform(pVessel.transform);
            }
            flightCam.ActivateUpdate();

            isFirstPerson = false;

            EnableRenderingOnPrevious(previousVessel);

            //Exit first person

            if (OnExitFirstPerson != null)
            {
                OnExitFirstPerson(currentfpeva);
            }
            currentfpeva = null;

            //Restore stuff that changed in the evacontroller
            if (previousVessel != null && previousVessel.evaController != null)
            {
                //Axis control settings
                ReflectedMembers.eva_manualAxisControl.SetValue(previousVessel.evaController, false);
                ReflectedMembers.eva_cmdRot.SetValue(previousVessel.evaController, Vector3.zero);

                //Pack power (from fine controls)
                previousVessel.evaController.rotPower = 1f;
                previousVessel.evaController.linPower = 0.3f;
            }

            KeyDisabler.instance.restoreAllKeys(KeyDisabler.eDisableLockSource.FirstPersonEVA);
        }
Exemplo n.º 7
0
        public static void RestoreCameraParent()
        {
            // Only execute if we're actually controlling the camera.
            if (!ManualControl)
            {
                return;
            }

            // Restore camera control to vessel.
            FlightCamera.fetch.transform.parent = _originalParentTransform;
            _originalParentTransform            = null;

            ManualControl = false;

            ActiveFlightCamera.ActivateUpdate();

            // Say something.
            Extensions.PostScreenMessage("[KerbTown] FlightCamera restored to vessel.");
        }
Exemplo n.º 8
0
        public void disable()
        {
            if (KerbalKonstructs.useLegacyCamera)
            {
                if (oldTarget != null)
                {
                    cam.transform.parent = oldTarget;
                }
                cam.ActivateUpdate();

                //for legacy control
                InputLockManager.RemoveControlLock("KKCamControls");
            }
            else
            {
                cam.SetTargetVessel(FlightGlobals.ActiveVessel);
            }
            active = false;
        }