a bit more stuff

This commit is contained in:
2026-05-31 19:14:19 +02:00
parent 69c941b0e1
commit c9ec6c6c55
14 changed files with 180 additions and 81 deletions

29
Scripts/EnergyManager.cs Normal file
View File

@@ -0,0 +1,29 @@
using System.Collections.Generic;
using System.Linq;
using Godot;
namespace NodeWar.Scripts;
[Singleton]
public partial class EnergyManager
{
public List<EnergyProducer> 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);
}
}