private void UpdateDemand() { foreach (Resource item in outputs) { item.samples [curSample] = tr.GetConsumption(item.resource.name); curSample = (curSample + 1) % numSamples; if (item.samples.Average() > tr.GetConsumption(item.resource.name)) { demand = item.samples.Average(); } else { demand = tr.GetConsumption(item.resource.name); } //demand = demand * 1.01 + 0.005; } }
public override void OnFixedUpdate() { rate = tr.GetGeneration("ElectricCharge") - tr.GetConsumption("ElectricCharge"); trLog.Enqueue(rate); trLog.Dequeue(); if (checkTimer.Good) { CheckMode(); } switch (mode) { case state.Disabled: return; case state.Full: return; case state.Depleted: return; case state.Charging: return; } }