PotatoPlan/Game1/Sources/Pathing/PriorityQueueC5.cs

54 lines
1.0 KiB
C#
Raw Permalink Normal View History

2020-05-07 22:09:45 +02:00
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);
}
2020-05-10 18:17:53 +02:00
public int getCount()
{
return queue.Count();
}
2020-05-07 22:09:45 +02:00
}