using System;
using System.Linq;
using Microsoft.Xna.Framework;
using MLEM.Misc;
namespace MLEM.Pathfinding {
///
/// A 2-dimensional implementation of that uses for positions.
///
public class AStar2 : AStar {
private static readonly Point[] AdjacentDirs = Direction2Helper.Adjacent.Offsets().ToArray();
private static readonly Point[] AllDirs = Direction2Helper.All.Offsets().ToArray();
///
public AStar2(GetCost defaultCostFunction, bool defaultAllowDiagonals, float defaultCost = 1, int defaultMaxTries = 10000) :
base(AllDirs, AdjacentDirs, defaultCostFunction, defaultAllowDiagonals, defaultCost, defaultMaxTries) {
}
///
protected override Point AddPositions(Point first, Point second) {
return first + second;
}
///
protected override float GetManhattanDistance(Point first, Point second) {
return Math.Abs(second.X - first.X) + Math.Abs(second.Y - first.Y);
}
}
}