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


[CustomEditor(typeof(MapManager))]
public class MapManagerCustomEditor : Editor
{
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        MapManager MapMan = (MapManager)target;
        
        if (GUILayout.Button("Update Neighbors"))
        {
            foreach (MapLocation loc in MapMan.Locations)
            {
                foreach (MapLocation neighbor in loc.Neighbors)
                {
                    if (!neighbor.Neighbors.Contains(loc))
                    {
                        neighbor.Neighbors.Add(loc);
                        EditorUtility.SetDirty(neighbor);
                        Debug.Log("Added" + loc.gameObject.name + " to " + neighbor.gameObject.name);
                    }
                }
            }
        }
    }
}
