public void Collect([NotNull] UnitViewModel unit) { Assert.IsNotNull(unit, nameof(unit)); var income = unit.Income.TakeAll(); Resources.Add(income); }
public void UpgradeUnit([NotNull] UnitViewModel unit) { Assert.IsNotNull(unit, nameof(unit)); var config = GetUnitConfig(unit.Type); if (config == null) { return; } if (unit.Level.Value >= (config.Levels.Count - 1)) { return; } var upgradePrice = unit.UpgradePrice.Value.Model; if (Resources.TryTake(upgradePrice)) { unit.Upgrade(); } }