protected override float GetScaleOffset() { CameraManager.CameraMode mode = CameraManager.Instance.currentCameraMode; if (mode != CameraManager.CameraMode.IVA) { FlightCamera camera = FlightCamera.fetch; if (camera == null) { return(0.0f / 400.0f); } switch (camera.mode) { case FlightCamera.Modes.AUTO: return(250.0f / 400.0f); case FlightCamera.Modes.FREE: return(200.0f / 400.0f); case FlightCamera.Modes.ORBITAL: return(150.0f / 400.0f); case FlightCamera.Modes.CHASE: return(100.0f / 400.0f); case FlightCamera.Modes.LOCKED: return(50.0f / 400.0f); default: return(0.0f / 400.0f); } } else { return(300.0f / 400.0f); } }
private void SetCameraMode(string value) { if (shared.Vessel.isActiveVessel) { switch (value.ToUpper().Trim()) { case ("AUTO"): FlightCamera.SetMode(FlightCamera.Modes.AUTO); break; case ("CHASE"): FlightCamera.SetMode(FlightCamera.Modes.CHASE); break; case ("FREE"): FlightCamera.SetMode(FlightCamera.Modes.FREE); break; case ("LOCKED"): FlightCamera.SetMode(FlightCamera.Modes.LOCKED); break; case ("ORBITAL"): FlightCamera.SetMode(FlightCamera.Modes.ORBITAL); break; default: throw new KOSException("Cannot set cameramode, invalid input value."); } } }
void Start() { windowRect = new Rect(Screen.width - windowWidth - 5, 45, windowWidth, windowHeight); isDefault = true; flightCamera = FlightCamera.fetch; SaveOriginalCamera(); AddToolbarButton(); GameEvents.onHideUI.Add(GameUIDisable); GameEvents.onShowUI.Add(GameUIEnable); //GameEvents.onGamePause.Add (PostDeathRevert); GameEvents.OnVesselRecoveryRequested.Add(PostDeathRevert); GameEvents.onFloatingOriginShift.Add(OnFloatingOriginShift); GameEvents.onGameSceneLoadRequested.Add(PostDeathRevert); cameraParent = new GameObject("StationaryCameraParent"); //cameraParent.SetActive(true); //cameraParent = (GameObject) Instantiate(cameraParent, Vector3.zero, Quaternion.identity); if (FlightGlobals.ActiveVessel != null) { cameraParent.transform.position = FlightGlobals.ActiveVessel.transform.position; vessel = FlightGlobals.ActiveVessel; } }
void onLevelWasLoadedGUIReady(GameScenes scene) { if (scene != GameScenes.PSYSTEM) { return; } Debug.Log($"[TINU] onLevelWasLoadedGUIReady: {scene} fc: {FlightCamera.fetch}"); if (FlightCamera.fetch is TINUFlightCamera) { return; } var fcType = typeof(FlightCamera); var fcFields = fcType.GetFields(bindingFlags); FlightCamera stockCamera = FlightCamera.fetch; GameObject scGameObject = stockCamera.gameObject; FlightCamera.fetch = null; var tinuCamera = scGameObject.AddComponent <TINUFlightCamera>(); foreach (var field in fcFields) { field.SetValue(tinuCamera, field.GetValue(stockCamera)); } Destroy(stockCamera); }
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; }
public void Awake() { GameEvents.onGUIApplicationLauncherReady.Add(onGUIApplicationLauncherReady); GameEvents.onGameSceneLoadRequested.Add(onSceneChangeRequest); GameEvents.onVesselChange.Add(onVesselChange); ESLDButtonOn = GameDatabase.Instance.GetTexture("ESLDBeacons/Textures/launcher", false); mainCam = FlightCamera.fetch; }
internal WarpFX(AlcubierreDrive drive) { camera = FlightCamera.fetch; CreateTrail(drive); if (!drive.isSlave) { CreatePlanes(drive); } }
public void FixedUpdate() { if (vessel == null) { return; } if (cam == null) { cam = FlightCamera.fetch; } if ((cam != null) && (origParent == null)) { origParent = cam.transform.parent; origClip = Camera.mainCamera.nearClipPlane; origFoV = Camera.mainCamera.fov; } if (camActive && (part.State == PartStates.DEAD)) { CleanUp(); } if (part.State == PartStates.DEAD) { camEnabled = false; } if ((part.State == PartStates.DEAD) && cameras.Contains(this)) { CleanUp(); } if (!cameras.Contains(this) && (part.State != PartStates.DEAD)) { cameras.Add(this); } if ((origParent != null) && (cam != null) && camActive) { cam.setTarget(null); cam.transform.parent = (cameraTransformName.Length > 0) ? part.FindModelTransform(cameraTransformName) : part.transform; cam.transform.localPosition = cameraPosition; cam.transform.localRotation = Quaternion.LookRotation(cameraForward, cameraUp); foreach (Camera c in Camera.allCameras) { c.fov = cameraFoV; } Camera.mainCamera.nearClipPlane = cameraClip; } base.OnFixedUpdate(); }
void Start() { //print("Starting Camera Focus Changer"); flightCamera = FlightCamera.fetch; pivotTranslateSharpness = 0.5f; hasReachedTarget = false; isFocusing = false; PluginConfiguration config = PluginConfiguration.CreateForType<CameraFocusChanger>(); config.load(); actionKey = config.GetValue<KeyCode>("actionKey"); }
void Start() { vessel = FlightGlobals.ActiveVessel; flightCamera = FlightCamera.fetch; origParent = flightCamera.transform.parent; origRotation = flightCamera.transform.rotation; origPosition = flightCamera.transform.position; origFOV = Camera.main.fieldOfView; origClip = Camera.main.nearClipPlane; }
/// <summary> /// Creates a camera for the main display /// </summary> private ICamera CreateCamera( CommandUser user ) { FlightCamera camera = new FlightCamera( ); camera.PerspectiveZNear = 2.0f; camera.PerspectiveZFar = 2000.0f; camera.Position = new Point3( 0, 0, 1001 ); FlightCameraController controller = new FlightCameraController( user, camera ); controller.MaxForwardSpeed = 20; controller.MaxSlipSpeed = 20; CommandControlInputSource.StartMonitoring( CommandUser.Default, display1, FlightCameraController.DefaultBindings ); return camera; }
void Awake() { if (instance != null) { Destroy (this); return; } if (config == null) { config = PluginConfiguration.CreateForType<KeepItStraight> (); } config.load (); camera = FlightCamera.fetch; GameEvents.onFlightReady.Add (FlightReady); GameEvents.onPartCouple.Add (onPartCouple); }
public void enable(GameObject targ) { cam = FlightCamera.fetch; if (cam) { cam.DeactivateUpdate(); oldTarget = cam.transform.parent; cam.transform.parent = targ.transform; active = true; } else { Debug.LogError("FlightCamera doesn't exist!"); } }
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); }
/// <summary> /// Constructor /// </summary> void Awake() { if (instance != null) { Destroy(this); return; } if (config == null) { config = PluginConfiguration.CreateForType <KeepItStraight>(); } config.load(); camera = FlightCamera.fetch; GameEvents.onFlightReady.Add(FlightReady); GameEvents.onPartCouple.Add(PartCouple); }
protected override float GetDegrees() { FlightCamera camera = FlightCamera.fetch; Vessel vessel = FlightGlobals.ActiveVessel; if (camera == null || CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.Map || CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.IVA || IsOrbitCamera(camera)) { Off(); return(180.0f); } if (IsRelativeCamera(camera)) { Relative(); } else { Absolut(); } if (vessel == null || vessel.mainBody == null || vessel.altitude > vessel.mainBody.Radius / 2) { NotInLimits(); Off(); } else { InLimits(); On(); } float hdg = (180.0f * FlightCamera.CamHdg / (float)Math.PI) % 360; if (hdg < 0) { hdg = 360 + hdg; } return(hdg); }
public static void SetCameraParent(Transform parentTransform) { // Assign FlightCamera instance to public var. ActiveFlightCamera = FlightCamera.fetch; // For replacing the camera when done editing. if (_originalParentTransform == null) _originalParentTransform = ActiveFlightCamera.transform.parent; // For translating the camera if (ActiveCameraPivot != null) Object.Destroy(ActiveCameraPivot); ActiveCameraPivot = new GameObject("KtCamPivot"); ActiveCameraPivot.transform.parent = parentTransform; ActiveCameraPivot.transform.localPosition = Vector3.zero; ActiveCameraPivot.transform.localRotation = Quaternion.identity; // Switch to active object. ActiveFlightCamera.transform.parent = ActiveCameraPivot.transform; // Use the FlightCamera sensitivity for the speed. CameraSpeed = ActiveFlightCamera.orbitSensitivity; // Take control of the flight camera. ActiveFlightCamera.DeactivateUpdate(); // Instruct LateUpdate that we're controlling the camera manually now. ManualControl = true; // Say something. Extensions.PostScreenMessage("[KerbTown] FlightCamera switched to: " + parentTransform.name); }
public Part SelectPartUnderMouse() { FlightCamera CamTest = new FlightCamera(); CamTest = FlightCamera.fetch; Ray ray = CamTest.mainCamera.ScreenPointToRay(Input.mousePosition); LayerMask RayMask = new LayerMask(); RayMask = 1 << 0; RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity, RayMask)) { Part hitPart = (Part)UIPartActionController.GetComponentUpwards("Part", hit.collider.gameObject); //how to find small parts that are "inside" the large part they are attached to. if (FlightGlobals.ActiveVessel.parts.Contains(hitPart)) { return hitPart; } else { return null; } //return FlightGlobals.ActiveVessel.Parts.Find(p => p.gameObject == hit.transform.gameObject); } return null; }
public void FixedUpdate() { if (vessel == null) { return; } if (cam == null) { cam = (FlightCamera)GameObject.FindObjectOfType(typeof(FlightCamera)); } if ((cam != null) && (origParent == null)) { origParent = cam.transform.parent; origClip = Camera.mainCamera.nearClipPlane; origFoV = Camera.mainCamera.fov; } if (camActive && (part.State == PartStates.DEAD)) { CleanUp(); } if (part.State == PartStates.DEAD) { camEnabled = false; } if ((part.State == PartStates.DEAD) && cameras.Contains(this)) { CleanUp(); } if (!cameras.Contains(this) && (part.State != PartStates.DEAD)) { cameras.Add(this); } if ((origParent != null) && (cam != null) && camActive) { cam.setTarget(null); cam.transform.parent = part.transform; cam.transform.localPosition = cameraPosition; cam.transform.localRotation = Quaternion.LookRotation(cameraForward, cameraUp); foreach (Camera c in cam.GetComponentsInChildren<Camera>()) { c.fov = cameraFoV; } Camera.mainCamera.nearClipPlane = cameraClip; } base.OnFixedUpdate(); }
private void Start() { FlightCamera[] cams = FlightCamera.FindObjectsOfType(typeof(FlightCamera)) as FlightCamera[]; cam = cams[0]; warpText = FindObjectOfType<ScreenMessages>(); warpTextColor = warpText.textStyles[1].normal.textColor; //EVENTS GameEvents.onFlightReady.Add(this.onFlightReady); GameEvents.onGameSceneLoadRequested.Add(this.onGameSceneLoadRequested); GameEvents.onGamePause.Add(this.onGamePause); GameEvents.onGameUnpause.Add(this.onGameUnpause); GameEvents.onHideUI.Add(this.onHideUI); GameEvents.onShowUI.Add(this.onShowUI); GameEvents.onLevelWasLoaded.Add(this.onLevelWasLoaded); GameEvents.onTimeWarpRateChanged.Add(this.onTimeWarpRateChanged); GameEvents.onPartDestroyed.Add(this.onPartDestroyed); GameEvents.onVesselDestroy.Add(this.onVesselDestroy); GameEvents.onVesselGoOffRails.Add(this.onVesselGoOffRails); }
void Start() { windowRect = new Rect(Screen.width-windowWidth-5, 45, windowWidth, windowHeight); isDefault = true; flightCamera = FlightCamera.fetch; SaveOriginalCamera(); AddToolbarButton(); GameEvents.onHideUI.Add(GameUIDisable); GameEvents.onShowUI.Add(GameUIEnable); //GameEvents.onGamePause.Add (PostDeathRevert); GameEvents.OnVesselRecoveryRequested.Add(PostDeathRevert); GameEvents.onFloatingOriginShift.Add(OnFloatingOriginShift); GameEvents.onGameSceneLoadRequested.Add(PostDeathRevert); cameraParent = new GameObject("StationaryCameraParent"); //cameraParent.SetActive(true); //cameraParent = (GameObject) Instantiate(cameraParent, Vector3.zero, Quaternion.identity); if(FlightGlobals.ActiveVessel != null) { cameraParent.transform.position = FlightGlobals.ActiveVessel.transform.position; vessel = FlightGlobals.ActiveVessel; } }
public void FixedUpdate() { // In the VAB if (vessel == null) { return; } if (part.State == PartStates.DEAD) { if (camActive) { LeaveCamera(); } Events["ActivateCamera"].guiActive = false; Events["EnableCamera"].guiActive = false; camEnabled = false; camActive = false; DirtyWindow(); CleanUp(); return; } if (!sAllowMainCamera && sCurrentCamera == null && !vessel.isEVA) { camActive = true; sCurrentCamera = this; } if (!camActive) { return; } if (!camEnabled) { CycleCamera(1); return; } if (sCam == null) { sCam = FlightCamera.fetch; // No idea if fetch returns null in normal operation (i.e. when there isn't a game breaking bug going on already) // but the original code had similar logic. if (sCam == null) { return; } } // Either we haven't set sOriginParent, or we've nulled it when restoring the main camera, so we save it again here. if (sOrigParent == null) { SaveMainCamera(); } sCam.setTarget(null); sCam.transform.parent = (cameraTransformName.Length > 0) ? part.FindModelTransform(cameraTransformName) : part.transform; sCam.transform.localPosition = cameraPosition; sCam.transform.localRotation = Quaternion.LookRotation(cameraForward, cameraUp); sCam.SetFoV(cameraFoV); Camera.main.nearClipPlane = cameraClip; // If we're only allowed to cycle the active vessel and viewing through a camera that's not the active vessel any more, then cycle to one that is. if (sCycleOnlyActiveVessel && FlightGlobals.ActiveVessel != null && FlightGlobals.ActiveVessel != vessel) { CycleCamera(1); } base.OnFixedUpdate(); }
public override void drive(FlightCtrlState s) { if (cam == null) { cam = (FlightCamera)GameObject.FindObjectOfType(typeof(FlightCamera)); } if (seekCamera) { core.attitudeTo((cam.transform.position - vesselState.CoM).normalized, MechJebCore.AttitudeReference.INERTIAL, this); core.tmode = MechJebCore.TMode.DIRECT; core.trans_spd_act = 100; } if (goToBeach) { if (landing.prediction.landingLongitude > MechJebModuleLandingAutopilot.BEACH_LONGITUDE && !beachDecoupled) { if (beachThrottledDown) { translatron.recursiveDecouple(); beachDecoupled = true; } else { s.mainThrottle = 0; beachThrottledDown = true; } } } base.drive(s); }
public extern void setModeImmediate(FlightCamera.Modes m);
void Start() { DebugPrint("Starting Camera Focus Changer"); flightCamera = FlightCamera.fetch; pivotTranslateSharpness = 0.5f; hasReachedTarget = false; isFocusing = false; PluginConfiguration config = PluginConfiguration.CreateForType<CameraFocusChanger>(); config.load(); actionKey = config.GetValue<KeyCode>("actionKey", KeyCode.O); showUpdateMessage = config.GetValue<bool>("showUpdateMessage", true); GameEvents.OnCameraChange.Add(OnCameraChange); GameEvents.onVesselChange.Add(OnVesselChange); GameEvents.onVesselWillDestroy.Add(OnVesselWillDestroy); GameEvents.onVesselGoOnRails.Add(OnVesselGoOnRails); GameEvents.onStageSeparation.Add(OnStageSeparation); GameEvents.onUndock.Add(OnUndock); API.SetInstance(this); }
public Part SelectPartUnderMouse() { FlightCamera CamTest = new FlightCamera(); CamTest = FlightCamera.fetch; Ray ray = CamTest.mainCamera.ScreenPointToRay(Input.mousePosition); LayerMask RayMask = new LayerMask(); RayMask = 1 << 0; RaycastHit hit; if (Physics.Raycast(ray, out hit,Mathf.Infinity,RayMask)) { return FlightGlobals.ActiveVessel.Parts.Find(p => p.gameObject == hit.transform.gameObject); } return null; }
void Start() { windowRect = new Rect(Screen.width-windowWidth-40, 0, windowWidth, windowHeight); flightCamera = FlightCamera.fetch; cameraToolActive = false; SaveOriginalCamera(); AddToolbarButton(); GameEvents.onHideUI.Add(GameUIDisable); GameEvents.onShowUI.Add(GameUIEnable); //GameEvents.onGamePause.Add (PostDeathRevert); GameEvents.OnVesselRecoveryRequested.Add(PostDeathRevert); GameEvents.onFloatingOriginShift.Add(OnFloatingOriginShift); GameEvents.onGameSceneLoadRequested.Add(PostDeathRevert); cameraParent = new GameObject("StationaryCameraParent"); //cameraParent.SetActive(true); //cameraParent = (GameObject) Instantiate(cameraParent, Vector3.zero, Quaternion.identity); if(FlightGlobals.ActiveVessel != null) { cameraParent.transform.position = FlightGlobals.ActiveVessel.transform.position; vessel = FlightGlobals.ActiveVessel; CheckForBDAI(FlightGlobals.ActiveVessel); } bdAiTargetField = GetAITargetField(); GameEvents.onVesselChange.Add(SwitchToVessel); }
public extern void setMode(FlightCamera.Modes m);
protected override void onPartFixedUpdate() { core.onPartFixedUpdate(); base.onPartFixedUpdate(); if (eye == null) { eye = transform.Find("model/base/eye"); if (eye == null) { return; } } if (cam == null) { cam = (FlightCamera)GameObject.FindObjectOfType(typeof(FlightCamera)); } if (innereye == null) { eyelid = new Transform[2]; eyelidRot = new Quaternion[2]; eyelid[0] = eye.Find("eyelid1"); eyelid[1] = eye.Find("eyelid2"); if (eyelid[0] != null) { eyelidRot[0] = eyelid[0].localRotation; } if (eyelid[1] != null) { eyelidRot[1] = eyelid[1].localRotation; } innereye = eye.Find("innereye"); if (innereye != null) { innereyeRot = innereye.localRotation; } doors = new LandingLeg[] { null, null, null, null }; if (vessel != null) { foreach (Part p in vessel.parts) { if (p.name == "MultiMech.JebPod.Leg") { doors[0] = (LandingLeg)p; for (int i = 0; i < Math.Min(3, p.symmetryCounterparts.Count); i++) { doors[i + 1] = (LandingLeg)p.symmetryCounterparts[i]; } } } } } brainStress += core.stress * TimeWarp.fixedDeltaTime; brainStress -= brainStress * (((doors[0] == null) || (doors[0].legState == LandingLeg.LegStates.DEPLOYED)) ? brainStressReliefOpen : brainStressReliefClosed) * TimeWarp.fixedDeltaTime; if ((brainStress > brainStressMin) && (doors[0] == null) || (doors[0].legState == LandingLeg.LegStates.DEPLOYED)) { brain[0].particleEmitter.maxEmission = brain[1].particleEmitter.maxEmission = (brainStress - brainStressMin) * 1000.0F; brain[0].particleEmitter.minEmission = brain[1].particleEmitter.minEmission = brain[0].particleEmitter.maxEmission / 2.0F; brain[0].particleEmitter.emit = brain[1].particleEmitter.emit = true; } else { brain[0].particleEmitter.emit = brain[1].particleEmitter.emit = false; } if (brainStress >= brainStressMax) { foreach (LandingLeg door in doors) { if ((door != null) && (door.legState == LandingLeg.LegStates.RETRACTED)) { door.DeployOnActivate = true; door.force_activate(); } } } if (vessel.Landed || vessel.Splashed) { eye.localRotation = Quaternion.RotateTowards(eye.localRotation, Quaternion.identity, 360 * TimeWarp.fixedDeltaTime); if ((eyelid[0] != null) && (eyelid[1] != null)) { eyelid[0].localRotation = eyelidRot[0]; eyelid[1].localRotation = eyelidRot[1]; } } else { if (core.attitudeActive) { eye.rotation = Quaternion.RotateTowards(eye.rotation, core.attitudeGetReferenceRotation(core.attitudeReference) * core.attitudeTarget * Quaternion.Euler(90, 0, 0), 360 * TimeWarp.fixedDeltaTime); } else { if (brainStress < brainStressMin) { eye.rotation = Quaternion.RotateTowards(eye.rotation, Quaternion.LookRotation((cam.transform.position - eye.position).normalized, cam.transform.up) * Quaternion.Euler(90, 0, 0), 360 * TimeWarp.fixedDeltaTime); } else { eye.localRotation = Quaternion.RotateTowards(eye.localRotation, Quaternion.identity, 360 * TimeWarp.fixedDeltaTime); } } if ((eyelid[0] == null) || (eyelid[1] == null) || (innereye == null)) { return; } double eyeStressAngle = Math.Max(5, 27 - brainStress / 2); if ((blinkStatus == BlinkStatus.NONE) && (UnityEngine.Random.Range(0, 10.0F / TimeWarp.fixedDeltaTime) < (Time.time - blinkLast))) { blinkStatus = BlinkStatus.CLOSING; blinkProgress = 0; } switch (blinkStatus) { case BlinkStatus.CLOSING: eyeStressAngle *= 1 - blinkProgress; blinkProgress = Mathf.Clamp01(blinkProgress + TimeWarp.fixedDeltaTime * 10); if (blinkProgress >= 1) { blinkStatus = BlinkStatus.OPENING; blinkProgress = 0; } break; case BlinkStatus.OPENING: eyeStressAngle *= blinkProgress; blinkProgress = Mathf.Clamp01(blinkProgress + TimeWarp.fixedDeltaTime * 10); if (blinkProgress >= 1) { blinkStatus = BlinkStatus.NONE; blinkLast = Time.time; } break; } eyelid[0].localRotation = eyelidRot[0] * Quaternion.AngleAxis((float)eyeStressAngle, -Vector3.right); eyelid[1].localRotation = eyelidRot[1] * Quaternion.AngleAxis((float)eyeStressAngle, Vector3.right); innereye.localRotation = innereyeRot * Quaternion.AngleAxis((Mathf.PingPong(Time.time, 0.05f) * 40 - 1) * Mathf.Sqrt(brainStress) / 10, Vector3.forward); } }
public extern static void SetModeImmediate(FlightCamera.Modes m);
protected override void onPartFixedUpdate() { core.onPartFixedUpdate(); base.onPartFixedUpdate(); if (eye == null) { eye = transform.Find("model/base/eye"); if (eye == null) { return; } } if (cam == null) { cam = (FlightCamera)GameObject.FindObjectOfType(typeof(FlightCamera)); } if (core.attitudeActive) { eye.rotation = Quaternion.RotateTowards(eye.rotation, core.attitudeGetReferenceRotation(core.attitudeReference) * core.attitudeTarget * Quaternion.Euler(90, 0, 0), 360 * TimeWarp.fixedDeltaTime); } else { if (brainStress < brainStressMin) { eye.rotation = Quaternion.RotateTowards(eye.rotation, Quaternion.LookRotation((cam.transform.position - eye.position).normalized, cam.transform.up) * Quaternion.Euler(90, 0, 0), 360 * TimeWarp.fixedDeltaTime); } else { eye.localRotation = Quaternion.RotateTowards(eye.localRotation, Quaternion.identity, 360 * TimeWarp.fixedDeltaTime); } } brainStress += core.stress * TimeWarp.fixedDeltaTime; brainStress -= brainStress * ((shellStat != ShellStat.CLOSED) ? brainStressReliefOpen : brainStressReliefClosed) * TimeWarp.fixedDeltaTime; if (brainStress < brainStressMin) { brain.particleEmitter.emit = false; lightUp = false; brain.light.intensity = 0; } else { if (shellStat != ShellStat.CLOSED) { brain.particleEmitter.maxEmission = (brainStress - brainStressMin) * 1000.0F; brain.particleEmitter.minEmission = brain.particleEmitter.maxEmission / 2.0F; brain.particleEmitter.emit = true; } if (lightUp) { brain.light.intensity -= TimeWarp.fixedDeltaTime * Mathf.Sqrt(brainStress); if (brain.light.intensity <= 0) { lightUp = false; } } else { brain.light.intensity += TimeWarp.fixedDeltaTime * Mathf.Sqrt(brainStress); if (brain.light.intensity >= 1.0F) { lightUp = true; } } } if ((shellStat == ShellStat.CLOSED) && (brainStress >= brainStressMax)) { shellStat = ShellStat.EJECTING; shellDecay = 0; } if (shellStat == ShellStat.EJECTING) { shellDecay += TimeWarp.fixedDeltaTime; transform.Find("model/base/shell01").position += (transform.Find("model/base/shell01").position - transform.Find("model/base").position).normalized * 50 * TimeWarp.fixedDeltaTime; transform.Find("model/base/shell02").position += (transform.Find("model/base/shell02").position - transform.Find("model/base").position).normalized * 50 * TimeWarp.fixedDeltaTime; transform.Find("model/base/shell03").position += (transform.Find("model/base/shell03").position - transform.Find("model/base").position).normalized * 50 * TimeWarp.fixedDeltaTime; if (shellDecay >= 5) { GameObject.Destroy(transform.Find("model/base/shell01").gameObject); GameObject.Destroy(transform.Find("model/base/shell02").gameObject); GameObject.Destroy(transform.Find("model/base/shell03").gameObject); shellStat = ShellStat.EJECTED; } } }