Neg_Utils/NEG/UI/UnityUi/Buttons/ButtonReaction.cs

15 lines
434 B
C#

using System;
using UnityEngine;
namespace NEG.UI.UnityUi.Buttons
{
[RequireComponent(typeof(BaseButton))]
public abstract class ButtonReaction : MonoBehaviour
{
protected virtual void Awake() => GetComponent<BaseButton>().OnButtonPressed += OnClicked;
protected virtual void OnDestroy() => GetComponent<BaseButton>().OnButtonPressed -= OnClicked;
protected abstract void OnClicked();
}
}