private IEnumerator <object> TurnSmoothingOffForOneFrame(object camBehaviour) { var oldValue = (float)Refl.GetValue(camBehaviour, "sharpness"); Refl.SetValue(camBehaviour, "sharpness", float.MaxValue); yield return(null); Refl.SetValue(camBehaviour, "sharpness", oldValue); }
public void Start() { log = new Log(this.GetType().Name); log.Debug("Start"); if (gui == null) { gui = this.gameObject.AddComponent <MainMenuGui> (); gui.UpdateToolbarStock(); gui.SetVisible(false); } config = readConfig(); KspIssue3838Fix.ApplyFix(config.enableExperimentalEditorExtensionsCompatibility); editorFSM = (KerbalFSM)Refl.GetValue(EditorLogic.fetch, "\u0001"); cursorLocker = Application.platform == RuntimePlatform.WindowsPlayer ? new WinCursorLocker() : (CursorLocker) new UnityLocker(); movementBounds = new Bounds(); if (EditorDriver.editorFacility == EditorFacility.VAB) { movementBounds = config.vab.bounds; } else if (EditorDriver.editorFacility == EditorFacility.SPH) { movementBounds = config.sph.bounds; } if (!config.enforceBounds) { movementBounds = new Bounds(Vector3.zero, Vector3.one * float.MaxValue); } var restartListener = new EventVoid.OnEvent(this.OnEditorRestart); GameEvents.onEditorRestart.Add(restartListener); OnCleanup += () => GameEvents.onEditorRestart.Remove(restartListener); var partEventListener = new EventData <ConstructionEventType, Part> .OnEvent(this.OnPartEvent); GameEvents.onEditorPartEvent.Add(partEventListener); OnCleanup += () => GameEvents.onEditorPartEvent.Remove(partEventListener); if (config.defaultCamera) { SwitchMode(false); ResetCamera(); } }