void Update() { if (productIdEnum == ProductIdEnum.Banana1) { int nextTimeToWatch = AdUtil.GetNextTimeToWatch(); if (nextTimeToWatch == 0) { costInCentsTxt.text = "Watch Ad"; } else { string nextTimeToWatchFormatted = TransformTime(nextTimeToWatch); costInCentsTxt.text = "Next Ad in " + nextTimeToWatchFormatted; } } }
public void Buy() { if (productIdEnum == ProductIdEnum.Banana1 && AdUtil.GetNextTimeToWatch() == 0) { bool successfulAdShown = false; menuAudioManager.PlayMainButtonClick(); successfulAdShown = ShowAd(); if (successfulAdShown) { iapWindowDisplay.SetActive(false); } } else { bool successfulBuy = false; if (productIdEnum == ProductIdEnum.Banana2) { successfulBuy = iapManager.Buy100Bananas(this); } else if (productIdEnum == ProductIdEnum.Banana3) { successfulBuy = iapManager.Buy250Bananas(this); } else if (productIdEnum == ProductIdEnum.Banana4) { successfulBuy = iapManager.Buy500Bananas(this); } else if (productIdEnum == ProductIdEnum.Banana5) { successfulBuy = iapManager.Buy1000Bananas(this); } else if (productIdEnum == ProductIdEnum.Banana6) { successfulBuy = iapManager.Buy2000Bananas(this); } if (successfulBuy) { menuAudioManager.PlayBuyButtonClick(); iapWindowDisplay.SetActive(false); } } }