// Public Methods protected override void Update(long timePassed) { if (BoonStack.Count > 0 && timePassed > 0) { _lastSrcRemoves.Clear(); var toAdd = new BoonSimulationItemIntensity(BoonStack); if (GenerationSimulation.Count > 0) { BoonSimulationItem last = GenerationSimulation.Last(); if (last.End > toAdd.Start) { last.SetEnd(toAdd.Start); } } GenerationSimulation.Add(toAdd); long diff = Math.Min(BoonStack.Min(x => x.BoonDuration), timePassed); long leftOver = timePassed - diff; // Subtract from each for (int i = BoonStack.Count - 1; i >= 0; i--) { var item = new BoonStackItem(BoonStack[i], diff, diff); BoonStack[i] = item; if (item.BoonDuration == 0) { _lastSrcRemoves.Add(item.SeedSrc); } } BoonStack.RemoveAll(x => x.BoonDuration == 0); Update(leftOver); } }
// Public Methods public override void update(long time_passed) { if (boon_stack.Count > 0) { var toAdd = new BoonSimulationItemIntensity(boon_stack); if (simulation.Count > 0) { BoonSimulationItem last = simulation.Last(); if (last.getEnd() > toAdd.getStart()) { last.setEnd(toAdd.getStart()); } } simulation.Add(toAdd); // Subtract from each for (int i = boon_stack.Count - 1; i >= 0; i--) { var item = new BoonStackItem(boon_stack[i], time_passed, -time_passed); if (item.boon_duration <= 0) { boon_stack.RemoveAt(i); } else { boon_stack[i] = item; } } } }
// Public Methods protected override void Update(long timePassed) { if (BoonStack.Count > 0) { var toAdd = new BoonSimulationItemIntensity(BoonStack); if (GenerationSimulation.Count > 0) { BoonSimulationItem last = GenerationSimulation.Last(); if (last.End > toAdd.Start) { last.SetEnd(toAdd.Start); } } GenerationSimulation.Add(toAdd); // Subtract from each for (int i = BoonStack.Count - 1; i >= 0; i--) { var item = new BoonStackItem(BoonStack[i], timePassed, timePassed); BoonStack[i] = item; } BoonStack.RemoveAll(x => x.BoonDuration < 1); } }