using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Graphics; using C5; class Nodes : IComparable, IEqualityComparer, IPriorityQueueHandle { private int F = 0; private int G = 0; private int H = 0; private Vector2 Coordinates; private Nodes Parent = null; private int Direction = 0; public Nodes(Vector2 coordinates) { Coordinates = coordinates; } public Nodes(Vector2 coordinates, int direction) { Coordinates = coordinates; Direction = direction; } public Nodes(int f, Vector2 coordinates) { Coordinates = coordinates; F = f; } public Nodes(Nodes node) { F = node.F; G = node.G; H = node.H; Coordinates = node.Coordinates; Parent = node.Parent; } public Nodes(int f, int g, int h, Vector2 coordinates, Nodes parent) { F = f; G = g; H = h; Coordinates = coordinates; Parent = parent; } public Vector2 getCords() { return Coordinates; } public int getF() { return F; } public int getG() { return G; } public int getH() { return H; } public void calculateF() { F = G + H; } public void setG(int g) { G = g; } public void setH(int h) { H = h; } public Nodes getParent() { return Parent; } public void setParent(Nodes parent) { Parent = parent; } public int getDirection() { return Direction; } public int CompareTo(Nodes other) { if (this.F < other.F) return -1; else if (this.F > other.F) return 1; else return 0; } public bool Equals(Nodes source, Nodes other) { return (source.Coordinates.X == other.Coordinates.X && source.Coordinates.Y == other.Coordinates.Y); } public int GetHashCode(Nodes nodes) { return (nodes.Coordinates.GetHashCode()); } }