rabidus-test/Assets/Scripts/EnergyController.cs

24 lines
522 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class EnergyController : MonoBehaviour, ITextChangable
{
[SerializeField]
private float _energy;
public UnityEvent<object> OnTextChange => _OnTextChange;
private UnityEvent<object> _OnTextChange = new UnityEvent<object>();
public float Energy
{
get => _energy;
set
{
_energy = value;
_OnTextChange?.Invoke(_energy);
}
}
}