Exemplo n.º 1
0
        public string Purchase(PlayerPerk playerPerk = null, bool usePerkCurrency = true)
        {
            if (purchased > 0 && !repeatable)
            {
                return("Error trying to re-purchase non-repeatable perk");
            }

            if (repeatable && purchased >= limit)
            {
                return("Limit reached");
            }

            if (usePerkCurrency && playerPerk != null)
            {
                if (playerPerk.GetPerkCurrency() < cost)
                {
                    return("Insufficient perk currency");
                }
                playerPerk.SpendCurrency(cost);
            }

            purchased += 1;

            return("");
        }
Exemplo n.º 2
0
 public int GetPerkCurrency()
 {
     return(perk != null?perk.GetPerkCurrency() : 0);
 }