Esempio n. 1
0
 public void Move(IPortalable moveable)
 {
     Transform2 v = moveable.GetVelocity();
     Transform2 t = moveable.GetTransform();
     if (Input.KeyDown(Key.Left))
     {
         v.Position += t.GetRight() * -Acceleration * Math.Abs(Transform2.GetSize(moveable));
     }
     if (Input.KeyDown(Key.Right))
     {
         v.Position += t.GetRight() * Acceleration * Math.Abs(Transform2.GetSize(moveable));
     }
     if (Input.KeyDown(Key.Up))
     {
         v.Position += t.GetUp() * Acceleration * Math.Abs(Transform2.GetSize(moveable));
     }
     if (Input.KeyDown(Key.Down))
     {
         v.Position += t.GetUp() * -Acceleration * Math.Abs(Transform2.GetSize(moveable));
     }
     v.Position *= 1 - Friction;
     moveable.SetVelocity(v);
 }