Server.Multis.BaseBoat.GetMovementFor C# (CSharp) Méthode

GetMovementFor() public méthode

public GetMovementFor ( int x, int y, int &maxSpeed ) : Direction
x int
y int
maxSpeed int
Résultat Direction
		public Direction GetMovementFor( int x, int y, out int maxSpeed )
		{
			int dx = x - this.X;
			int dy = y - this.Y;

			int adx = Math.Abs( dx );
			int ady = Math.Abs( dy );

			Direction dir = Utility.GetDirection( this, new Point2D( x, y ) );
			int iDir = (int) dir;

			// Compute the maximum distance we can travel without going too far away
			if ( iDir % 2 == 0 ) // North, East, South and West
				maxSpeed = Math.Abs( adx - ady );
			else // Right, Down, Left and Up
				maxSpeed = Math.Min( adx, ady );

			return (Direction) ((iDir - (int)Facing) & 0x7);
		}