public bool BurnRay() { if (vessel.radarAltitude <= burn.burnAltitude) { RaycastHit hit; Ray rcray = new Ray(this.part.transform.position, FlightGlobals.getGeeForceAtPosition(this.vessel.transform.position)); if (Physics.Raycast(rcray, out hit) && hit.distance < Math.Abs(this.vessel.verticalSpeed) / 2) { burn.Fire(); burn.triggered = true; return(true); } else { return(false); } } else { return(false); } }
public void FixedUpdate() { if (IsActivate == true) { //Landing Burn if (burn != null) { if (alreadyFired == false) { if (vessel.radarAltitude <= burn.burnAltitude) { burn.Fire(); alreadyFired = true; } } } //Inflate Buoy if (buoy != null) { if (alreadyInflated == false) { if (vessel.Splashed) { buoy.Inflate(); alreadyInflated = true; } } } //Airbag if (airbag != null) { //Inflate Airbag if (alreadyInflatedAirBag == false) { if (vessel.radarAltitude <= airbag.inflateAltitude) { airbag.Inflate(); alreadyInflatedAirBag = true; } } //Deflate Airbag if (alreadyInflatedAirBag == true && alreadyDeflatedAirBag == false) { if (vessel.Landed) { //Debug.Log("<color=#FF8C00ff>[Comfortable Landing]</color>Landed!"); airbag.Deflate(); alreadyDeflatedAirBag = true; } else if (vessel.Splashed && airbag.damageAfterSplashed == true) { //Debug.Log("<color=#FF8C00ff>[Comfortable Landing]</color>Splashed with damage"); airbag.Deflate(); alreadyDeflatedAirBag = true; } else if (vessel.Splashed && airbag.damageAfterSplashed == false) { //Debug.Log("<color=#FF8C00ff>[Comfortable Landing]</color>Splashed with out damage"); airbag.Touchdown(); alreadyDeflatedAirBag = true; } } } //Check if (vessel.Landed || vessel.Splashed) { Events["Deactivate"].guiActive = false; Events["Activate"].guiActive = false; IsActivate = false; Debug.Log("<color=#FF8C00ff>[Comfortable Landing]</color>The vessel has landed or splashed, deactivate pre-landing mode."); } } }