PotatoPlan/Game1/Sources/Pathing/PriorityQueueC5.cs
2020-05-10 18:17:53 +02:00

54 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using C5;
class PriorityQueueC5
{
private readonly Astar astar = new Astar();
private IPriorityQueue<PQEntry> queue = new IntervalHeap<PQEntry>();
public void AddToQueue(List<PQEntry> nodes)
{
foreach (PQEntry item in nodes)
{
PQEntry temp = new PQEntry
{
Key = item.Key,
Coordinates = item.Coordinates
};
queue.Add(temp);
}
}
public void AddToQueue(int x, int y, int score)
{
PQEntry temp = new PQEntry
{
Key = score,
Coordinates = new Vector2(x, y)
};
queue.Add(temp);
}
public PQEntry DeleteMax()
{
return queue.DeleteMax();
}
public void AddAll(List<PQEntry> entryList)
{
queue.AddAll(entryList);
}
public int getCount()
{
return queue.Count();
}
}