/// <summary> /// Constructor /// </summary> public Pathfinder() { open = new SimpleList<Position>(); closed = new SimpleList<Position>(); random = new Random(); start = new Position(); target = new Position(); check = new Position(); }
/// <summary> /// Constructor /// </summary> /// <param name="x">horizontal coordinate</param> /// <param name="y">vertical coordinate</param> /// <param name="g">number of steps from the starting point</param> /// <param name="parent">position leading to this position (default = null)</param> public Position(int x, int y, params Position[] parent) { location = new int[] { x, y }; if (parent.Length > 0) { this.parent = parent[0]; g = this.parent.g + 1; } }