using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;

/// <summary>
/// отмена создания стены, маяка, зоны
/// </summary>
public class HistoryController : MonoBehaviour
{
    public Button redo;
    public Button undo; // отмена
    public List<History> histories = new List<History>();
    
   


    // Start is called before the first frame update
    void Start()
    {
        undo.onClick.AddListener(Undo);
    }

    // Update is called once per frame
    void Update()
    {

    }

 
    void Undo() {
        var last = histories.Last();
        last.obj.SetActive(false);
        last.ButtonPanel.SetActive(false);
        last.status = false;
    }
  
    public void EventHistory(uint id, GameObject gameObject, GameObject panel)
    {
        histories.Add(new History { id = id, obj = gameObject, ButtonPanel = panel, status = true });
    }
}
