Пример #1
0
 void Running()
 {
     if (xAxis != 0 && mov2D.Grounded && !mov2D.GetRolling())
     {
         //mov2D.SetVelX(RUN_MAX_VEL * xAxis);
         if (Mathf.Abs(mov2D.GetVelocity().x) < RUN_MIN_VEL)
         {
             mov2D.SetVelX(RUN_MIN_VEL * Mathf.Sign(xAxis));
         }
         //else
         //mov2D.SetVelX(Mathf.Clamp(mov2D.GetVelocity().x * RUN_ACCEL, -RUN_MAX_VEL, RUN_MAX_VEL));
         mov2D.SetAccel(Vector3.right * RUN_ACCEL * Mathf.Sign(xAxis));
         mov2D.SetVelX(Mathf.Clamp(mov2D.GetVelocity().x, -RUN_MAX_VEL, RUN_MAX_VEL));
     }
 }