void Update() { Vessel pVessel = FlightGlobals.ActiveVessel; FlightCamera flightCam = FlightCamera.fetch; if (pVessel == null) { return; } if (pVessel.isEVA && !pVessel.packed && pVessel.loaded && pVessel.evaController != null) { if (pVessel != lastHookedVessel) { lastHookedVessel = pVessel; //KSPLog.print (string.Format("{0} switched to, hooking vessel for general hooks.", pVessel.GetName())); EVABoundFix.Hook(pVessel.evaController); } } if (FlightGlobals.ActiveVessel.isEVA && fpCameraManager.isFirstPerson && needCamReset) { fpCameraManager.isFirstPerson = false; fpCameraManager.CheckAndSetFirstPerson(pVessel); } needCamReset = false; if (HighLogic.LoadedSceneIsFlight && pVessel != null && pVessel.isActiveVessel && pVessel.state != Vessel.State.DEAD && !stopTouchingCamera) { if (forceEVA || fpCameraManager.isFirstPerson) { if (!fpCameraManager.isCameraProperlyPositioned(flightCam)) { fpCameraManager.isFirstPerson = false; } fpCameraManager.CheckAndSetFirstPerson(pVessel); } if (!forceEVA && pVessel.isEVA) { if (Input.GetKeyDown(toggleFirstPersonKey)) { if (!fpCameraManager.isFirstPerson) { fpCameraManager.saveCameraState(flightCam); fpCameraManager.CheckAndSetFirstPerson(pVessel); } else { fpCameraManager.resetCamera(pVessel); } } } fpCameraManager.updateGUI(); } if (fpCameraManager.isFirstPerson && resetivacamerabinding.GetKeyDown()) { fpCameraManager.viewToNeutral(); fpCameraManager.reorient(); } if (OnUpdate != null) { OnUpdate(this, null); } }
public static void Hook(KerbalEVA eva) { //The reference is held by the replacement delegate. EVABoundFix temp = new EVABoundFix(eva); }