rabidus-test/Assets/Scripts/EnergyController.cs

24 lines
522 B
C#
Raw Permalink Normal View History

2023-07-28 11:48:57 +03:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
2023-08-15 17:38:54 +03:00
public class EnergyController : MonoBehaviour, ITextChangable
2023-07-28 11:48:57 +03:00
{
[SerializeField]
private float _energy;
2023-08-15 17:38:54 +03:00
public UnityEvent<object> OnTextChange => _OnTextChange;
private UnityEvent<object> _OnTextChange = new UnityEvent<object>();
2023-07-28 11:48:57 +03:00
public float Energy
{
get => _energy;
set
{
_energy = value;
2023-08-15 17:38:54 +03:00
_OnTextChange?.Invoke(_energy);
2023-07-28 11:48:57 +03:00
}
}
}