Beispiel #1
0
    public UpgradeInformations GetUpgradeInformations()
    {
        UpgradeInformations upgradeInformations = new UpgradeInformations();

        if (Level == Level.Level3)
        {
            return(null);
        }

        switch (Level)
        {
        case Level.Level1:
            upgradeInformations.Gold     = goldToLevel2;
            upgradeInformations.Building = buildingToLevel2;
            upgradeInformations.Food     = foodToLevel2;
            break;

        case Level.Level2:
            upgradeInformations.Gold     = goldToLevel3;
            upgradeInformations.Building = buildingToLevel3;
            upgradeInformations.Food     = foodToLevel3;
            break;

        default:
            break;
        }

        return(upgradeInformations);
    }
Beispiel #2
0
    public bool ConsumeItens(UpgradeInformations upgradeInformations)
    {
        if (upgradeInformations == null)
        {
            return(false);
        }

        if (upgradeInformations.Gold <= this.Gold &&
            upgradeInformations.Building <= this.Building &&
            upgradeInformations.Food <= this.Food)
        {
            Gold     -= upgradeInformations.Gold;
            Building -= upgradeInformations.Building;
            Food     -= upgradeInformations.Food;
            hud.UpdateHUD();
            return(true);
        }
        return(false);
    }