using System; using AsteroidGame.Interfaces; using UnityEngine; namespace AsteroidGame.Entities { public class PowerBase : MonoBehaviour, IPowerSystem { [Header("State")] [SerializeField] protected bool _isGenerator = true; [SerializeField] protected bool _isConsumer = true; [SerializeField] protected int _maxPower; [SerializeField] protected int _currentPower; public void SetConfig(SPowerConfig config) { _isGenerator = config.isGenerator; _isConsumer = config.isConsumer; _maxPower = config.maxPower; } #region Setters public void SetMaxPower(int newValue) => _maxPower = newValue; #endregion #region Getters public bool IsGenerator => _isGenerator; public bool IsConsumer => _isConsumer; public int GetMaxPower() => _maxPower; public int GetCurrentPower() => _currentPower; public float GetPowerFactor() => (float)_currentPower / _maxPower; #endregion } }