// Use this for initialization void Start() { StorePriceScriptableObject storePrice = StoreObjectPurchaseController.Instance.StorePrice; StorePriceScriptableObject.StorePriceMap storePriceMap = storePrice.GetStorePriceMap(storeObject); Title.text = storeObject.ToString(); Description.text = storePriceMap.Description; Gem.SetActive(storePriceMap.PurchaseUsingGem); string PriceText = storePriceMap.PurchaseUsingGem ? storePriceMap.Price.ToString() : "$ " + storePriceMap.Price.ToString(); Price.text = PriceText; ActiveObjects.text = "Active Items : " + StoreObjectPurchaseController.Instance.GetNoOfStoreObjectPurchased(storeObject); Image.sprite = storePriceMap.Image; }
public bool IsSuffientFundsAvailable(StoreObject storeObject) { bool sufficientFundsAvailable = false; StorePriceScriptableObject.StorePriceMap storePriceMap = StorePrice.GetStorePriceMap(storeObject); if (storePriceMap.PurchaseUsingGem) { if (GemScript.Instance.TotalGems >= storePriceMap.Price) { sufficientFundsAvailable = true; } } return(sufficientFundsAvailable); }
public void PurchaseStoreObject(StoreObject storeObject) { StorePriceScriptableObject.StorePriceMap storePriceMap = StorePrice.GetStorePriceMap(storeObject); if (storePriceMap.PurchaseUsingGem) { if (GemScript.Instance.TotalGems >= storePriceMap.Price) { AddStoreObject(storeObject); GemScript.Instance.TotalGems -= (int)storePriceMap.Price; OnPurchaseComplete(storeObject); } } else { return; } }
public void ShowPurchaseConfirmPopUp(int storeObjectIndex) { StoreObjectPurchaseController.StoreObject storeObject = (StoreObjectPurchaseController.StoreObject)storeObjectIndex; if (StoreObjectPurchaseController.Instance.IsSuffientFundsAvailable(storeObject)) { StorePriceScriptableObject storePrice = StoreObjectPurchaseController.Instance.StorePrice; StorePriceScriptableObject.StorePriceMap storePriceMap = storePrice.GetStorePriceMap(storeObject); PriceText.text = storePriceMap.Price.ToString(); PurchaseItemImage.sprite = storePriceMap.NoBgImage; ConfirmationPopUp.SetActive(true); PopUpsBg.enabled = true; storeObjectSelected = storeObject; } else { InsufficientFundsPopUp.SetActive(true); PopUpsBg.enabled = true; StartCoroutine(InsufficientFundTimeoutCoroutine()); } }