Пример #1
0
 private void PushRotation(MoveSubmarine sub, float value)
 {
     value             = value * 1000;
     sub.subRotation   = 0f;
     sub.counterTorque = 0f;
     if (sub.subStats != null)
     {
         float num = Mathf.Clamp((float)sub.subStats.subEnginePower, 0f, 2.8f);
         if (Mathf.Sign(sub.transform.localScale.x) == Mathf.Sign(sub.localScaleXPrevious))
         {
             if (Mathf.Abs(value) > 0f)
             {
                 sub.subRotation = Mathf.Round(value) * (sub.subRotationSpeed + (1f + num) / 8f) * sub.horizDir * -1f * sub.torqueScalar;
             }
             else
             {
                 float num2 = Mathf.Sign(Mathf.DeltaAngle(sub.currentAngle, 90f));
                 float num3 = Mathf.Abs(Mathf.DeltaAngle(sub.currentAngle, 90f));
                 float num4 = 1f / (1f + Mathf.Pow(2.78128f, -num3 + sub.levelBounceDampening));
                 sub.subRotation = num2 * sub.subRotationSpeed * num4 * sub.torqueScalar;
             }
             float f = Mathf.DeltaAngle(90f, sub.currentAngle);
             sub.counterTorque = Mathf.Abs(Mathf.DeltaAngle(90f, sub.currentAngle));
             sub.counterTorque = 5f / (1f + Mathf.Pow(2.78128f, -0.3f * sub.counterTorque + 0.3f * sub.subAngleLimit));
             sub.counterTorque = sub.counterTorque * sub.subRotationSpeed * Mathf.Sign(f) * 1.05f * sub.torqueScalar;
             sub.subRotation  -= sub.counterTorque;
             if (GameControllerBehavior.playerInNavigation == NetworkManagerBehavior.myLocalPlayer || (GameControllerBehavior.playerInNavigation == null && sub.isServer))
             {
                 sub.syncSubRotation = sub.subRotation;
             }
         }
     }
 }
Пример #2
0
 private void PushEngineChange(MoveSubmarine sub, float value)
 {
     if (value > 0 && sub.subStats.NetworksubEnginePower != 3)
     {
         sub.subStats.NetworksubEnginePower += 1;
     }
     else if (value < 1 && sub.subStats.NetworksubEnginePower != 0)
     {
         sub.subStats.NetworksubEnginePower -= 1;
     }
 }
Пример #3
0
 private void PushFlip(MoveSubmarine sub, float value)
 {
     if (value < 0 && !sub.flipping)
     {
         sub.horizDir      = -1f;
         sub.desiredXScale = -1f;
         sub.flipping      = true;
     }
     else if (value > 0 && !sub.flipping)
     {
         sub.horizDir      = 1f;
         sub.desiredXScale = 1f;
         sub.flipping      = true;
     }
 }