Exemple #1
0
    /// <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);
    }
Exemple #2
0
    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);
        }
    }
Exemple #3
0
 private bool HasCurrency(Constants.CurrencyTypes currencyType)
 {
     return(Currencies.ContainsKey(currencyType));
 }