Пример #1
0
    public void Inicialization()
    {
        gold        = new Gold(0);
        passiveGold = new PasiiveGold(0);
        tapGold     = new GoldForTap(1);
        upgrades    = new List <Upgrade>(GameController.inst.gameData.upgrades);


        foreach (var upgrade in upgrades)
        {
            collector.add = upgrade.state.Where(val => val == UpgradeState.Buyed).Listen(val =>
            {
                if (upgrade.upgradeType == UpgradeType.Active)
                {
                    AddResourseGold(GameController.inst.playerData.tapGold, upgrade.addResources);
                }

                if (upgrade.upgradeType == UpgradeType.Passive)
                {
                    AddResoursePassiveGold(GameController.inst.playerData.passiveGold, upgrade.addResources);
                }
            });
            collector.add = upgrade.level.Bind(val =>
            {
                if (upgrade.upgradeType == UpgradeType.Active)
                {
                    AddResourseGold(GameController.inst.playerData.tapGold, upgrade.addResources);
                }

                if (upgrade.upgradeType == UpgradeType.Passive)
                {
                    AddResoursePassiveGold(GameController.inst.playerData.passiveGold, upgrade.addResources);
                }
            });
        }
    }
Пример #2
0
 public void AddResoursePassiveGold(PasiiveGold gold, Resources res)
 {
     gold.Apply(res.count.value);
 }
Пример #3
0
 public void Inicialization()
 {
     gold        = new Gold(0);
     passiveGold = new PasiiveGold(0);
 }