/// <summary> /// Performs minerals-to-food transactions and updates the energy level progress bar accordingly. /// </summary> /// <param name="inventory">Inventory.</param> /// <param name="convertedAmount">Converted amount.</param> public static void PurchaseFood(Inventory inventory, int convertedAmount) { _foodPurchased = convertedAmount; // store the amount for conversion to energy inventory.DeductPointsForFood(convertedAmount); double validPercentage = FoodConvertableToEnergy(); MetaHandler.IncreaseEnergy(validPercentage); }
/// <summary> /// Performs minerals-to-food transactions using only the player's balance /// </summary> /// <param name="convertedAmount">Converted amount.</param> public static void PurchaseFoodFromBalance(int convertedAmount) { GetMineralValue(); // int foodKGAvailable = 0; if (convertedAmount <= _balance) { _balance -= convertedAmount; } double validPercentage = FoodConvertableToEnergy(); MetaHandler.IncreaseEnergy(validPercentage); }