using Grid; using TMPro; using UnityEngine; public class PathfindingGridDebugObject : GridDebugObject { [SerializeField] private TextMeshPro gCostText; [SerializeField] private TextMeshPro hCostText; [SerializeField] private TextMeshPro fCostText; [SerializeField] private SpriteRenderer isWalkableSpriteRenderer; private PathNode pathNode; public override void SetGridObject(object gridObject) { base.SetGridObject(gridObject); pathNode = (PathNode)gridObject; } protected override void Update() { base.Update(); gCostText.text = $"G:{pathNode.GCost.ToString()}"; hCostText.text = $"H:{pathNode.HCost.ToString()}"; fCostText.text = $"F:{pathNode.FCost.ToString()}"; isWalkableSpriteRenderer.color = pathNode.IsWalkable ? new(0, 1, 0, .1f) : new(1, 0, 0, .1f); } }