using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PathNode {

    private GridXZ<PathNode> grid;
    public int x;
    public int z;

    public int gCost;
    public int hCost;
    public int fCost;

    public bool isWalkable;

    public PathNode cameFromNode;

    public PathNode(GridXZ<PathNode> grid, int x, int z) {
        this.grid = grid;
        this.x = x;
        this.z = z;
        isWalkable = true;
    }

    public void CalculateFCost() {
        fCost = gCost + hCost;
    }

    public override string ToString() {
        return x + "," + z;
    }

    internal void SetIsWalkable(bool value) {
        isWalkable = value;
        grid.TriggerGridObjectChanged(x, z);
    }
}
