public void Update(float deltaTime, IGenerationGlobalContext context) { double time = TimeOfRound(context); double profit = ProfitPerRound(context); double profitPerSec = profit / time; ProfitResult.UpdateFromOther(new ProfitResult(profit, profitPerSec, time)); if (IsAutomatic) { if (!IsGenerationStarted) { SetGenerationStarted(true); } } if (IsGenerationStarted) { AddGenerateTimer(deltaTime); double interval = AccumulateInterval; GameEvents.OnAccumulationProgressChanged(this, GenerateTimer, interval, ProfitResult); accumulatedCash += ProfitResult.ValuePerSecond * deltaTime; if (GenerateTimer >= interval) { GameEvents.OnAccumulationCompleted(this, ProfitResult); SetGenerateTimer(0f); GameEvents.OnAccumulationProgressChanged(this, GenerateTimer, interval, ProfitResult); accumulatedCash = 0.0; if (IsManual) { SetGenerationStarted(false); } } } }
public void FireProgressEvent() { GameEvents.OnAccumulationProgressChanged(this, GenerateTimer, AccumulateInterval, ProfitResult); }