예제 #1
0
    void PurchaseItem()
    {
        var storeEntry = gridLayoutGroup.Find(selection);

        if (storeEntry != null)
        {
            var storeItem = storeEntry.GetComponent <StoreItem>();
            var so        = storeItem.GetItem();

            if (so is WeaponMod)
            {
                var gm = GameManager.Instance;
                var wm = (WeaponMod)so;
                if (gm.saveData.currency >= wm.purchasePrice)
                {
                    var currency = playerStatsManager.UnlockMod(wm);
                    itemsOwned.Add(so);
                    UpdatePlayerCurrency(currency);
                    Destroy(storeEntry.gameObject);
                    SetSelection(null);
                }
            }
        }
    }