Example #1
0
    void UpdateGoldCost(Dictionary <string, Resource> resources)
    {
        GoldResource gold = (GoldResource)resources[ResourceType.GOLD];

        Text goldCost = GameObject.Find(UIConstants.UPGRADE_ARMY_COST)
                        .GetComponent <Text>();

        goldCost.text = ResourceFormatter.Format(gold.upgradeCost) + " " +
                        UIConstants.ARMY_SYMBOL;
    }
Example #2
0
    public void UpgradeArmy(GoldResource gold)
    {
        if (gold.currentAmount >= upgradeCost)
        {
            // Deduct gold
            gold.currentAmount -= upgradeCost;

            // Update growing rate and multipliers
            growingRateSeconds *= upgradeMultiplier;

            // Update upgrade cost
            upgradeCost *= upgradeCostFactor;
        }
    }
Example #3
0
        public void PostConstruct()
        {
            GridSize = new Vector2(20, 20);
            UnitGridSize = 160.0f ;
            GameDataPath = "Data/Game/";

            m_TickRates = new Dictionary<IResource,float>();

            IResource wood = new WoodResource();
            IResource food = new FoodResource();
            IResource gold = new GoldResource();
            IResource stone = new StoneResource();

            m_TickRates.Add(wood,3);
            m_TickRates.Add(food, 5);
            m_TickRates.Add(gold, 15);
            m_TickRates.Add(stone, 30);
        }
Example #4
0
        public GameModel()
        {
            Wood = new WoodResource();
            Wood.Value = 0;

            Food = new FoodResource();
            Food.Value = 0;

            Stone = new StoneResource();
            Stone.Value = 0;

            Gold = new GoldResource();
            Gold.Value = 0;

            m_ResourceList = new List<IResource>();

            m_ResourceList.Add(Wood);
            m_ResourceList.Add(Food);
            m_ResourceList.Add(Gold);
            m_ResourceList.Add(Stone);
        }
Example #5
0
    public void UpgradeGold()
    {
        GoldResource gold = (GoldResource)resources[ResourceType.GOLD];

        gold.UpgradeGold((ArmyResource)resources[ResourceType.ARMY]);
    }