using System;
using UnityEngine;
using UnityEngine.Events;

public class BunkerStation : MonoBehaviour
{
	private bool _isLocked = false;

	public UnityEvent OnUse;
	public UnityEvent OnLockedUse;

	private Action _interactEvent;
	public event Action InteractEvent
	{
		add
		{
			_interactEvent -= value;
			_interactEvent += value;
		}
		remove
		{
			_interactEvent -= value;
		}
	}

	public virtual void Press()
	{
		if (_isLocked)
		{
			OnLockedUse?.Invoke();
			return;
		}

		OnUse?.Invoke();
		_interactEvent?.Invoke();
	}

	public void Lock(bool locked)
	{
		_isLocked = locked;
	}

}
