public void Click(Clickable clickable) { float amount = clickable.Amount; Currency currency = clickable.Currency; ApplyClickPerks(clickable, ref amount); ApplyCurrencyPerk(currency, ref amount); bool updated = UpdateTotal(currency, amount); UpdateUnlocks(); if (updated) { OnTick.Invoke(); } }
private void ApplyClickPerks(Clickable clickable, ref float amount) { foreach (Upgrade upgrade in State.EarnedUpgrades) { foreach (UpgradePerk upgradePerk in upgrade.UpgradePerk) { if (upgradePerk.TargetClickable != clickable) { continue; } switch (upgradePerk.Operation) { case Operation.Add: amount += upgradePerk.Amount; break; case Operation.Multiply: amount *= upgradePerk.Amount; break; } } } }