/// <summary> /// Tells if the Player has enough currency of a specific type for something. /// </summary> /// <param name="currencyType"></param> /// <param name="amount"></param> /// <returns></returns> public bool HasEnoughCurrency(Constants.CurrencyTypes currencyType, uint amount) { if (HasCurrency(currencyType) == false) { if (amount == 0) { return(true); } return(false); } return(Currencies[currencyType] >= amount); }
public void SubtractCurrency(Constants.CurrencyTypes currencyType, uint currencySubtracted) { if (HasCurrency(currencyType) == false) { Currencies.Add(currencyType, 0); } Currencies[currencyType] = Util.Clamp(Currencies[currencyType] - currencySubtracted, Constants.MIN_CURRENCY, Constants.MAX_CURRENCY); if (CurrencySubtractedEvent != null) { CurrencySubtractedEvent(currencyType, currencySubtracted); } }
private bool HasCurrency(Constants.CurrencyTypes currencyType) { return(Currencies.ContainsKey(currencyType)); }