override public void Remove(uint amount_) { if (amount_ == 0) { return; } var evolution = new Evolution() { Previous = amount }; if (amount_ >= amount) { evolution.Removed = amount; amount = 0; expiration = 0; scheduler.Stop(ref coroutine); } else { evolution.Removed = amount_; amount -= amount_; } evolution.Current = amount; _Changed(evolution); }
void RemoveFromGroups(uint amount_) { amount_ = Math.Min(amount, amount_); amount -= amount_; while (groups.Count > 0 && amount_ > 0) { if (groups[0].amount > amount_) { groups[0].amount -= amount_; amount_ = 0; } else { amount_ -= groups[0].amount; scheduler.Stop(ref groups[0].coroutine); groups.RemoveAt(0); } } }