public void Tick(PlayerResources pr) { if (Done) { if (OnComplete != null) OnComplete(); return; } if (Paused) return; if (pm.PowerState != PowerState.Normal) { if (--slowdown <= 0) slowdown = Queue.Info.LowPowerSlowdown; else return; } var costThisFrame = RemainingCost / RemainingTime; if (costThisFrame != 0 && !pr.TakeCash(costThisFrame)) return; RemainingCost -= costThisFrame; RemainingTime -= 1; if (RemainingTime > 0) return; Done = true; }
public void Tick(PlayerResources pr) { if (!Started) { var time = Queue.GetBuildTime(Item); if (time > 0) RemainingTime = TotalTime = time; Started = true; } if (Done) { if (OnComplete != null) OnComplete(); return; } if (Paused) return; if (pm.PowerState != PowerState.Normal) { if (--Slowdown <= 0) Slowdown = Queue.Info.LowPowerSlowdown; else return; } var costThisFrame = RemainingCost / RemainingTime; if (costThisFrame != 0 && !pr.TakeCash(costThisFrame, true)) return; RemainingCost -= costThisFrame; RemainingTime -= 1; if (RemainingTime > 0) return; Done = true; }