namespace Holo.Virtual.Rooms.Pathfinding { using System; using System.Collections; public class AStarNode : IComparable { private double FCost; private double FGoalEstimate; private AStarNode FGoalNode; private AStarNode FParent; public AStarNode(AStarNode AParent, AStarNode AGoalNode, double ACost) { this.FParent = AParent; this.FCost = ACost; this.GoalNode = AGoalNode; } public virtual void Calculate() { this.FGoalEstimate = 0.0; } public int CompareTo(object obj) { return -this.TotalCost.CompareTo(((AStarNode) obj).TotalCost); } public override bool Equals(object obj) { return this.IsSameState((AStarNode) obj); } public override int GetHashCode() { return base.GetHashCode(); } public virtual void GetSuccessors(ArrayList ASuccessors) { } public bool IsGoal() { return this.IsSameState(this.FGoalNode); } public virtual bool IsSameState(AStarNode ANode) { return false; } public virtual void PrintNodeInfo() { } public double Cost { get { return this.FCost; } set { this.FCost = value; } } public double GoalEstimate { get { this.Calculate(); return this.FGoalEstimate; } set { this.FGoalEstimate = value; } } public AStarNode GoalNode { get { return this.FGoalNode; } set { this.FGoalNode = value; this.Calculate(); } } public AStarNode Parent { get { return this.FParent; } set { this.FParent = value; } } public double TotalCost { get { return (this.Cost + this.GoalEstimate); } } } }