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

DoMovement() public méthode

public DoMovement ( bool message ) : bool
message bool
Résultat bool
		public bool DoMovement( bool message )
		{
			Direction dir;
			int speed, clientSpeed;

			if ( this.Order == BoatOrder.Move )
			{
				dir = m_Moving;
				speed = m_Speed;
				clientSpeed = m_ClientSpeed;
			}
			else if ( MapItem == null || MapItem.Deleted )
			{
				if ( message && TillerMan != null )
					TillerMan.Say( 502513 ); // I have seen no map, sir.

				return false;
			}
			else if ( this.Map != MapItem.Map || !this.Contains( MapItem.GetWorldLocation() ) )
			{
				if ( message && TillerMan != null )
					TillerMan.Say( 502514 ); // The map is too far away from me, sir.

				return false;
			}
			else if ( this.Map != Map.Felucca || NextNavPoint < 0 || NextNavPoint >= MapItem.Pins.Count )
			{
				if ( message && TillerMan != null )
					TillerMan.Say( 1042551 ); // I don't see that navpoint, sir.

				return false;
			}
			else
			{
				Point2D dest = (Point2D) MapItem.Pins[NextNavPoint];

				int x, y;
				MapItem.ConvertToWorld( dest.X, dest.Y, out x, out y );

				int maxSpeed;
				dir = GetMovementFor( x, y, out maxSpeed );

				if ( maxSpeed == 0 )
				{
					if ( message && this.Order == BoatOrder.Single && TillerMan != null )
						TillerMan.Say( 1042874, (NextNavPoint + 1).ToString() ); // We have arrived at nav point ~1_POINT_NUM~ , sir.

					if ( NextNavPoint + 1 < MapItem.Pins.Count )
					{
						NextNavPoint++;

						if ( this.Order == BoatOrder.Course )
						{
							if ( message && TillerMan != null )
								TillerMan.Say( 1042875, (NextNavPoint + 1).ToString() ); // Heading to nav point ~1_POINT_NUM~, sir.

							return true;
						}

						return false;
					}
					else
					{
						NextNavPoint = -1;

						if ( message && this.Order == BoatOrder.Course && TillerMan != null )
							TillerMan.Say( 502515 ); // The course is completed, sir.

						return false;
					}
				}

				if ( dir == Left || dir == BackwardLeft || dir == Backward )
					return Turn( -2, true );
				else if ( dir == Right || dir == BackwardRight )
					return Turn( 2, true );

				speed = Math.Min( this.Speed, maxSpeed );
				clientSpeed = 0x4;
			}

			return Move( dir, speed, clientSpeed, true );
		}