private Economy getCostToUpgrade(int currentLevel, int maxLevels, float exponent, Economy baseCost) { if (currentLevel >= maxLevels) { return new Economy(); } else { return baseCost.applyGrowthCurve(currentLevel, exponent); } }