Beispiel #1
0
    private void HandleUpgrade(UpgradeShopItem upgrade)
    {
        switch (upgrade.UpgradeType)
        {
        case UpgradeTypeEnum.GoldProductionRate:
            GoldRatePerMinute += upgrade.Value;
            break;

        case UpgradeTypeEnum.WeightProductionRate:
            WeightRatePerMinute += upgrade.Value;
            break;

        case UpgradeTypeEnum.DamageModified:
            Animal.MinDamage += (int)upgrade.Value;
            Animal.MaxDamage += (int)upgrade.Value;
            break;

        case UpgradeTypeEnum.NotSet:
        case UpgradeTypeEnum.MaxOfflineWeightAmount:
        case UpgradeTypeEnum.MaxOfflineGoldAmount:
        default:
            Debug.LogError("Upgrade not implemented: " + nameof(upgrade.UpgradeType));
            return;
        }

        AddUpgrade(upgrade);
    }
Beispiel #2
0
    public void AddUpgrade(UpgradeShopItem upgrade)
    {
        PurchasedUpgradeIDs.Add(upgrade.GetInstanceID());

        Events.Raise(upgrade.GetInstanceID(), GameEventsEnum.EventUpgrade);
    }