namespace Holo.Virtual.Rooms.Pathfinding { using System; using System.Collections.ObjectModel; public class mapNode : IComparable { private double _esToGoal; internal double Cost; private Holo.Virtual.Rooms.Pathfinding.mapNode Goal; internal Holo.Virtual.Rooms.Pathfinding.mapNode Parent; internal Holo.Virtual.Rooms.Pathfinding.mapNode Start; internal int X; internal int Y; public mapNode(int X, int Y, double Cost, Holo.Virtual.Rooms.Pathfinding.mapNode Parent, Holo.Virtual.Rooms.Pathfinding.mapNode Goal, Holo.Virtual.Rooms.Pathfinding.mapNode Start) { this.Parent = Parent; this.Start = Start; this.Goal = Goal; this.X = X; this.Y = Y; this.Cost = Cost; } private Holo.Virtual.Rooms.Pathfinding.mapNode createNode(int X, int Y) { int num = this.X - this.Goal.X; int num2 = this.X - this.Goal.Y; int num3 = this.Start.X - this.Goal.X; int num4 = this.Start.Y - this.Goal.Y; double num5 = Math.Abs((int) ((num * num4) - (num3 * num2))) * 0.005; return new Holo.Virtual.Rooms.Pathfinding.mapNode(X, Y, this.Cost + num5, this, this.Goal, this.Start); } internal Collection Successors(DenDribbelaerPathfinder Pathfinder) { Collection collection = new Collection(); if (Pathfinder.Passable(this.X, this.Y, this.X - 1, this.Y)) { collection.Add(this.createNode(this.X - 1, this.Y)); } if (Pathfinder.Passable(this.X, this.Y, this.X + 1, this.Y)) { collection.Add(this.createNode(this.X + 1, this.Y)); } if (Pathfinder.Passable(this.X, this.Y, this.X, this.Y + 1)) { collection.Add(this.createNode(this.X, this.Y + 1)); } if (Pathfinder.Passable(this.X, this.Y, this.X, this.Y - 1)) { collection.Add(this.createNode(this.X, this.Y - 1)); } if (Pathfinder.Passable(this.X, this.Y, this.X - 1, this.Y + 1)) { collection.Add(this.createNode(this.X - 1, this.Y + 1)); } if (Pathfinder.Passable(this.X, this.Y, this.X - 1, this.Y - 1)) { collection.Add(this.createNode(this.X - 1, this.Y - 1)); } if (Pathfinder.Passable(this.X, this.Y, this.X, this.Y + 1)) { collection.Add(this.createNode(this.X, this.Y + 1)); } if (Pathfinder.Passable(this.X, this.Y, this.X, this.Y - 1)) { collection.Add(this.createNode(this.X, this.Y - 1)); } if (Pathfinder.Passable(this.X, this.Y, this.X + 1, this.Y + 1)) { collection.Add(this.createNode(this.X + 1, this.Y + 1)); } if (Pathfinder.Passable(this.X, this.Y, this.X + 1, this.Y - 1)) { collection.Add(this.createNode(this.X + 1, this.Y - 1)); } return collection; } int IComparable.CompareTo(object obj) { return -this.totalCost.CompareTo(((Holo.Virtual.Rooms.Pathfinding.mapNode) obj).totalCost); } internal double goalEstimate { get { if (this.Goal == null) { return 0.0; } int num = 2 * this.X; int num2 = ((2 * this.Y) + (this.X % 2)) - this.X; int num3 = ((-2 * this.Y) - (this.X % 2)) - this.X; int num4 = 2 * this.Goal.X; int num5 = ((2 * this.Goal.Y) + (this.Goal.X % 2)) - this.Goal.X; int num6 = ((-2 * this.Goal.Y) - (this.Goal.X % 2)) - this.Goal.X; return Math.Max(Math.Abs((int) (num - num4)), Math.Max(Math.Abs((int) (num2 - num5)), Math.Abs((int) (num3 - num6)))); } set { this._esToGoal = value; } } internal double totalCost { get { return (this.Cost + this.goalEstimate); } } } }