Esempio n. 1
0
 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.");
         }
     }
 }
Esempio n. 2
0
 public void FixedUpdate()
 {
     if (IsActivate == true)
     {
         //Landing Burn
         if (burn != null)
         {
             if (alreadyFired == false)
             {
                 if (BurnRay())
                 {
                     alreadyFired = true;
                 }
             }
             else
             {
                 if (this.vessel.situation != Vessel.Situations.LANDED || this.vessel.situation != Vessel.Situations.SPLASHED && burn.triggered)
                 {
                     foreach (Part p in this.vessel.parts)
                     {
                         if ((p.physicalSignificance == Part.PhysicalSignificance.FULL) && (p.rb != null))
                         {
                             Vector3 gee = FlightGlobals.getGeeForceAtPosition(this.vessel.transform.position);
                             p.AddForce(-gee.normalized * p.rb.mass * ((float)Math.Min(Math.Abs(this.vessel.verticalSpeed), gee.magnitude) + gee.magnitude));
                         }
                     }
                     Debug.Log(this.vessel.srf_velocity.magnitude);
                 }
             }
         }
         //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.");
         }
     }
 }