Updated PowerHandler
Calculates consumption and peak consumption
This commit is contained in:
parent
47fdfdbc66
commit
a70bd626a6
|
@ -8,6 +8,7 @@ namespace AsteroidGame.Handlers
|
|||
{
|
||||
[Header("State")]
|
||||
[SerializeField] private int _powerConsumption;
|
||||
[SerializeField] private int _powerConsumptionPeak;
|
||||
[SerializeField] private int _powerCapacity;
|
||||
[SerializeField] private float _powerFactor;
|
||||
|
||||
|
@ -17,12 +18,14 @@ namespace AsteroidGame.Handlers
|
|||
private void Update()
|
||||
{
|
||||
_powerConsumption = 0;
|
||||
_powerConsumptionPeak = 0;
|
||||
_powerCapacity = 0;
|
||||
foreach (var structure in _activeStructures._list)
|
||||
{
|
||||
if (structure.IsConsumer)
|
||||
{
|
||||
_powerConsumption += structure.GetMaxPower();
|
||||
_powerConsumption += structure.GetCurrentPower();
|
||||
_powerConsumptionPeak += structure.GetMaxPower();
|
||||
}
|
||||
|
||||
if (structure.IsGenerator)
|
||||
|
@ -46,14 +49,9 @@ namespace AsteroidGame.Handlers
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public int GetCurrentPower()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
public int GetCurrentPower() => _powerConsumption;
|
||||
|
||||
public float GetPowerFactor() => _powerFactor;
|
||||
|
||||
public float GetPowerFactor()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue