using System;
using Assets;
using UnityEditor;
using UnityEngine;
using Random = UnityEngine.Random;

namespace Editor
{
    [CustomEditor(typeof (LandmassGenerator))]
    public class LandmassGeneratorUI : UnityEditor.Editor
    {
        public override void OnInspectorGUI()
        {
            LandmassGenerator generator = (LandmassGenerator)target;
            
            DrawDefaultInspector();

            if (GUILayout.Button("Reset")) {
                generator.Reset();
            }
            
            if (GUILayout.Button("Generate Random"))
            {
                generator.seed = (int)(Random.value * int.MaxValue);
                generator.Reset();
                generator.Generate();
            }

            if (GUILayout.Button("Generate")) {
                generator.Generate();
            }
        }
    }
}