20 lines
556 B
C#
20 lines
556 B
C#
using System;
|
|
using KBCore.Refs;
|
|
using UnityEngine;
|
|
|
|
namespace NEG.UI.UnityUi.Buttons
|
|
{
|
|
[RequireComponent(typeof(BaseButton))]
|
|
public abstract class ButtonReaction : MonoBehaviour
|
|
{
|
|
[SerializeField, Self(Flag.Optional)] protected BaseButton button;
|
|
|
|
protected virtual void Awake() => button.OnButtonPressed += OnClicked;
|
|
|
|
protected virtual void OnDestroy() => button.OnButtonPressed -= OnClicked;
|
|
|
|
private void OnValidate() => this.ValidateRefs();
|
|
|
|
protected abstract void OnClicked();
|
|
}
|
|
} |