49 lines
994 B
C#
49 lines
994 B
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);
|
|||
|
}
|
|||
|
|
|||
|
}
|