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(""); }
public int GetPerkCurrency() { return(perk != null?perk.GetPerkCurrency() : 0); }