Server.MovementPath.MovementPath C# (CSharp) Méthode

MovementPath() public méthode

public MovementPath ( Server.Mobile m, Server.Point3D goal ) : System
m Server.Mobile
goal Server.Point3D
Résultat System
		public MovementPath( Mobile m, Point3D goal )
		{
			Point3D start = m.Location;
			Map map = m.Map;

			m_Map = map;
			m_Start = start;
			m_Goal = goal;

			if ( map == null || map == Map.Internal )
				return;

			if ( Utility.InRange( start, goal, 1 ) )
				return;

			try
			{
				PathAlgorithm alg = m_OverrideAlgorithm;

				if ( alg == null )
				{
					alg = FastAStarAlgorithm.Instance;

					//if ( !alg.CheckCondition( m, map, start, goal ) )	// SlowAstar is still broken
					//	alg = SlowAStarAlgorithm.Instance;		// TODO: Fix SlowAstar
				}

				if ( alg != null && alg.CheckCondition( m, map, start, goal ) )
					m_Directions = alg.Find( m, map, start, goal );
			}
			catch ( Exception e )
			{
				Console.WriteLine( "Warning: {0}: Pathing error from {1} to {2}", e.GetType().Name, start, goal );
			}
		}
	}