mirror of
https://github.com/lscharen/iigs-sprite-compiler.git
synced 2024-10-08 17:54:56 +00:00
22 lines
512 B
C#
22 lines
512 B
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace SpriteCompiler.AI
|
|||
|
{
|
|||
|
public class AStarComparator<A, S, T, C> : IComparer<T>
|
|||
|
where T : HeuristicSearchNode<A, S, T, C>
|
|||
|
where C : IPathCost<C>
|
|||
|
{
|
|||
|
public int Compare(T x, T y)
|
|||
|
{
|
|||
|
var cost1 = x.Heuristic.Add(x.PathCost);
|
|||
|
var cost2 = y.Heuristic.Add(y.PathCost);
|
|||
|
|
|||
|
return cost1.CompareTo(cost2);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|