rabidus-test/Assets/Scripts/EnergyController.cs

23 lines
425 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class EnergyController : MonoBehaviour
{
[SerializeField]
private float _energy;
public event UnityAction<float> OnEnergyChange;
public float Energy
{
get => _energy;
set
{
_energy = value;
OnEnergyChange?.Invoke(_energy);
}
}
}