Lerp() public static method

Performs a linear interpolation between two vectors.
public static Lerp ( Vector2 value1, Vector2 value2, float amount ) : Vector2
value1 Vector2 Source vector.
value2 Vector2 Source vector.
amount float Value between 0 and 1 indicating the weight of value2.
return Vector2
Beispiel #1
0
 public override void step()
 {
     Velocity.Y += FallSpeed;
     if (Collides(position + Vector2.UnitY))
     {
         Velocity.Y  = 0;
         position.Y  = (float)Math.Floor(position.Y);
         Velocity.X /= 1.2f;
     }
     Velocity.X /= 1.1f;
     if (Collides(position + Velocity))
     {
         Velocity = Vector2.Zero;
     }
     position += Velocity;
     if (Vector2.Distance(Player.LocalClient.position, position) <= 3)
     {
         position = Vector2.Lerp(position, Player.LocalClient.position, 0.1f);
     }
     if (Vector2.Distance(Player.LocalClient.position, position) <= 0.3f)
     {
         SoundManager.PlaySound(SoundManager.SfxCoinPickup);
         destroy();
     }
 }