source: lost-perception/astar/AStarNode.java@ 5db343b

Last change on this file since 5db343b was ebd3538, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 6 years ago

Initial commit. This codebase for the Lost Perception game was created by decompiling code from a jar file.

  • Property mode set to 100644
File size: 950 bytes
Line 
1package astar;
2
3import java.awt.Point;
4import java.util.LinkedList;
5
6public class AStarNode implements Comparable<AStarNode>
7{
8 public boolean passable;
9 private QuadTree parent;
10 public LinkedList<AStarNode> neighbors;
11 public int G;
12 public int H;
13 public AStarNode prev;
14 public int curList;
15 public int openListPos;
16
17 public AStarNode(final QuadTree parent) {
18 this.passable = true;
19 this.parent = parent;
20 this.G = -1;
21 this.H = -1;
22 this.curList = 0;
23 }
24
25 public QuadTree getParent() {
26 return this.parent;
27 }
28
29 public int getF() {
30 return this.G + this.H;
31 }
32
33 public Point getMidpoint() {
34 return new Point(this.parent.getX() + this.parent.getWidth() / 2, this.parent.getY() + this.parent.getHeight() / 2);
35 }
36
37 @Override
38 public int compareTo(final AStarNode o) {
39 return this.getF() - o.getF();
40 }
41}
Note: See TracBrowser for help on using the repository browser.