using System;
using UnityEngine;

public class PathfindingUpdater : MonoBehaviour {
    private void Start() {
        Crate.OnAnyDestroyed += Destructable_OnAnyDestroyed;
        Barrel.OnAnyDestroyed += Destructable_OnAnyDestroyed;
    }

    private static void Destructable_OnAnyDestroyed(object sender, EventArgs e) {
        if (sender is IDestructable destructable)
            Pathfinding.Instance.SetWalkableGridPosition(destructable.GridPosition, true);
    }
}