Skip to content

Instantly share code, notes, and snippets.

@wallstop
Created March 15, 2022 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wallstop/1513eb7679c7d45348bf917a407a76a5 to your computer and use it in GitHub Desktop.
Save wallstop/1513eb7679c7d45348bf917a407a76a5 to your computer and use it in GitHub Desktop.
PathNode
namespace Pathfinding
{
using UnityEngine;
public sealed class PathNode
{
public readonly Vector3Int position;
public int gCost = int.MaxValue;
public int hCost = 0;
public int fCost = 0;
public PathNode parentNode = null;
public PathNode(Vector3Int position)
{
this.position = position;
CalculateFCost();
}
public void CalculateFCost()
{
fCost = gCost + hCost;
}
public void Reset()
{
gCost = int.MaxValue;
hCost = 0;
fCost = 0;
parentNode = null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment