Ejemplo n.º 1
0
 private void FixedUpdate()
 {
     if (isFloating && isFlying)
     {
         if (currentFlightTime > 0)
         {
             if (!jetpackAudio.isPlaying)
             {
                 jetpackAudio.Play(); // Check if playing?
             }
             jetpackParticles.Play();
             sliderAnim.SetBool("OnFadeIn", true);
             sliderAnim.SetBool("OnUse", true);
             currentFlightTime -= flyUpFlightTimeDecrementMultiplier * Time.fixedDeltaTime;
             playerCharController.Move(Vector3.up * currentFlightAccel * Time.deltaTime);
             currentFlightAccel = Mathf.Lerp(currentFlightAccel, maxFlightAccel, flightAccelMultiplier * Time.deltaTime);
             playerFPController.DecreaseGravity(gravityLerpDecrementAmount);
         }
     }
     else
     {
         jetpackAudio.Stop();
         jetpackParticles.Stop();
         sliderAnim.SetBool("OnFadeIn", false);
         sliderAnim.SetBool("OnUse", false);
         if (currentFlightTime < flightTime)
         {
             currentFlightTime += Time.fixedDeltaTime * flightTimeRechargeMultiplier;
         }
         playerFPController.ResetGravity();
         currentFlightAccel = flightAccel;
     }
 }