Esempio n. 1
0
 public void Update()
 {
     if (animationControl != null)
     {
         animationControl.updateAnimationState();
         updateDragCube();
         if (controller != null)
         {
             float time = animationControl.animationTime;
             //if (invertAnimation) { time = 1 - time; }
             controller.setDeployTime(time);
         }
     }
 }
Esempio n. 2
0
 public void Update()
 {
     if (controller == null || wheel == null)
     {
         return;
     }
     if (controller.wheelState == KSPWheelState.DEPLOYED)
     {
         if (animationControl.state != KSPWheelState.DEPLOYED)
         {
             animationControl.setToAnimationState(KSPWheelState.DEPLOYED, false);
         }
         //calculate the speed at which to play the animation
         float speed = 0f;
         int   len   = controller.wheelData.Length;
         for (int i = 0; i < len; i++)
         {
             speed += Mathf.Abs(controller.wheelData[i].wheel.linearVelocity);
         }
         speed /= len;
         speed /= controller.maxSpeed;
         speed *= Mathf.Sign(wheel.rpm);
         if (invertAnimation)
         {
             speed = -speed;
         }
         animationControl.setAnimSpeedMult(speed);
         //update the effect for the current 'speed percent' value
         if (!string.IsNullOrEmpty(effectName))
         {
             part.Effect(effectName, speed);
         }
         animationControl.updateAnimationState();
     }
     else
     {
         if (!string.IsNullOrEmpty(effectName))
         {
             part.Effect(effectName, 0f);
         }
     }
 }