mirror of
https://github.com/lscharen/iigs-sprite-compiler.git
synced 2024-10-14 00:23:39 +00:00
22 lines
515 B
C#
22 lines
515 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 : ICost<C>, new()
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|