private void updateAnimation() { float dir = state == InterstageFairingState.DEPLOYING ? 1 : -1; float delta = TimeWarp.fixedDeltaTime * animationSpeed * dir; currentRotation += delta; if (state == InterstageFairingState.DEPLOYING && currentRotation >= deployedRotation) { currentRotation = deployedRotation; setPanelRotations(currentRotation); state = InterstageFairingState.DEPLOYED; if (jettisonPanels) { jettisonFairingPanels(); } updateGuiState(); } else if (state == InterstageFairingState.RETRACTING && currentRotation <= 0) { currentRotation = 0; setPanelRotations(currentRotation); state = InterstageFairingState.RETRACTED; updateShieldStatus(); updateGuiState(); } else { setPanelRotations(currentRotation); } updateDragCube(); }
private void onRetractEvent() { if (state == InterstageFairingState.DEPLOYING || state == InterstageFairingState.DEPLOYED) { state = InterstageFairingState.RETRACTING; updateGuiState(); } }
private void onDeployEvent() { if (state == InterstageFairingState.RETRACTED || state == InterstageFairingState.RETRACTING) { state = InterstageFairingState.DEPLOYING; if (autoDecoupleUpper) { decoupleByModule(topDecouplerModuleIndex); } updateShieldStatus(); updateGuiState(); } }
private void jettisonFairingPanels() { state = InterstageFairingState.JETTISONED; fairingBase.jettisonPanels(part, 10, Vector3.forward, 0.1f); }