public bool TryBuy(ShopItemDesc <T> desc)
    {
        if (!desc.CanBuyItem())
        {
            GameManager.Instance.DisplayDialog("Error: Insufficient " + (desc.takesStorage ? "storage" : "funds"), KeyCode.Return, (a) => { }, true);
            return(false);
        }
        if (!desc.takesStorage)
        {
            PersistentData.curBitcoins -= desc.cost;
        }
        else
        {
            PersistentData.curStorage -= desc.cost;
        }
        if (desc.isOneShot)
        {
            PlayerPrefs.SetInt(desc.slug, 1);
        }
        PlayerPrefs.Save();
        PersistentData.FlushValues();
        GameManager.Instance.DisplayDialog("Item purchased!", 1, () => { });

        if (desc.isVirus && Random.Range(0f, 1f) < desc.virusChance)
        {
            // Oh u dun fuked boi
            GameManager.Instance.TriggerVirus((ShopItemDesc <float>)(object) desc);
        }

        return(true);
    }
 public override void Buy(float param, ShopItemDesc <float> desc)
 {
     if (!TryBuy(desc))
     {
         return;
     }
     PersistentData.spawnsPerSec += desc.param;
     PersistentData.FlushValues();
 }
 public override void Buy(float param, ShopItemDesc <float> desc)
 {
     if (!TryBuy(desc))
     {
         return;
     }
     PersistentData.playerUseBoost = true;
     PersistentData.FlushValues();
 }
 public override void Buy(float param, ShopItemDesc <float> desc)
 {
     if (!TryBuy(desc))
     {
         return;
     }
     PersistentData.playerMoveSpeed += desc.param;
     PersistentData.FlushValues();
 }
 public override void Buy(int param, ShopItemDesc <int> desc)
 {
     if (!TryBuy(desc))
     {
         return;
     }
     PersistentData.damage += desc.param;
     PersistentData.FlushValues();
 }
 public bool CanBuy(ShopItemDesc <T> desc)
 {
     if (desc.takesStorage)
     {
         return(PersistentData.curStorage >= desc.cost);
     }
     else
     {
         return(PersistentData.curBitcoins >= desc.cost);
     }
 }
 public void TriggerVirus(ShopItemDesc <float> desc, bool bypassWait = false)
 {
     Debug.Log("Triggered");
     StartCoroutine(Virus((int)PersistentData.curBitcoins, desc != null ? desc.param : 0, bypassWait));
 }
 public abstract void Buy(T param, ShopItemDesc <T> desc);