-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPathNode.cs
More file actions
43 lines (33 loc) · 919 Bytes
/
PathNode.cs
File metadata and controls
43 lines (33 loc) · 919 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
namespace MyPathFinding
{
// This is this pathnode class.
public class PathNode
{
private Grid<PathNode> _pathNodeGrid;
public int X { get; set; }
public int Y { get; set; }
public int GCost { get; set; }
public int HCost { set; get; }
public int FCost { set; get; }
public PathNode CameFromNode { get; set; }
public bool IsWalkAble { get; set; }
// PathNode constructor.
public PathNode(Grid<PathNode> pathNodeGrid, int x, int y)
{
_pathNodeGrid = pathNodeGrid;
this.X = x;
this.Y = y;
IsWalkAble = true;
}
// Calculates F cost of node.
public void CalculateFCost()
{
FCost = HCost + GCost;
}
public override string ToString()
{
return X + "," + Y;
}
}
}