using System.Collections.Generic; using System.Linq; using Godot; namespace NodeWar.Scripts; [Singleton] public partial class EnergyManager { public List EnergyProducers { get; set; } = []; // TODO: privat set public float GetTotalEnergyCapacity() { // TODO: cache + dirty flag return EnergyProducers.Sum(energyProducer => energyProducer.EnergyCapacity); } public float GetEnergyGeneration() { // TODO: cache + dirty flag return EnergyProducers.Sum(energyProducer => energyProducer.EnergyGenerationRate); } public float GetEnergyStored() { // TODO: cache + dirty flag return EnergyProducers.Sum(energyProducer => energyProducer.EnergyStored); } }