a bit more stuff
This commit is contained in:
29
Scripts/EnergyManager.cs
Normal file
29
Scripts/EnergyManager.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user