// Refreshing the iteminfo and the cost. (till i can figure out a better save/load function void Update() { itemInfo.text = itemName + " (" + count + ")\nCost: " + CurCon.GetCurrencyPrefix(cost) + "\nGold " + CurCon.GetCurrencyPrefix(addPerSec) + " / s"; cost = Mathf.Round(baseCost * Mathf.Pow(1.12f, count)); if (count >= 10 && count < 25) { multiplier = 2; } else if (count >= 25 && count < 50) { multiplier = 4; } else if (count >= 50 && count < 75) { multiplier = 6; } else if (count >= 75 && count < 100) { multiplier = 8; } else if (count >= 100) { multiplier = 10; } }
// Updating the display info and gold per sec public void Update() { goldDisplay.text = "Gold: " + CurCon.GetCurrencyPrefix(gold); clickDisplay.text = "Gold / Click: " + CurCon.GetCurrencyPrefix(goldPerClick); dpsDisplay.text = "Gold / Sec: " + CurCon.GetCurrencyPrefix(goldPerSec); diamondDisplay.text = "Diamonds: " + diamonds; goldPerSec = FindObjectOfType <FancyText>().GetGoldPerSec(); timer -= Time.deltaTime; if (timer <= 0) { if (Advertisement.IsReady()) { Advertisement.Show("video", new ShowOptions() { resultCallback = HandleAdResult }); } timer = 300; } }
/*------------Buy Function------------*/ public void PurchasedUpgrade() { if (baseGame.gold < cost) { float goldDifference = cost - baseGame.gold; StartCoroutine(ShowMessage("You do not have the required amount of Gold to purchase " + itemName + ",\nYou are missing: " + CurCon.GetCurrencyPrefix(goldDifference) + " Gold.", 10)); } else { baseGame.gold -= cost; count += 1; baseGame.goldPerClick += minePower; cost = Mathf.Round(baseCost * Mathf.Pow(1.12f, count)); } }
// Refreshing the iteminfo and the cost. (till i can figure out a better save/load function void Update() { itemInfo.text = itemName + " (" + count + ")\nCost: " + CurCon.GetCurrencyPrefix(cost) + "\nMining Per Sec: " + CurCon.GetCurrencyPrefix(minePower); cost = Mathf.Round(baseCost * Mathf.Pow(1.12f, count)); }
/*------------Buy Function------------*/ public void PurchasedItem() { if (baseGame.gold < cost) { float goldDifference = cost - baseGame.gold; StartCoroutine(ShowMessage("You do not have the required amount of Gold,\n To purchase " + itemName + ",\nYou are missing: " + CurCon.GetCurrencyPrefix(goldDifference) + " Gold.", 10)); Debug.Log("Did not Buy one."); } else { baseGame.gold -= cost; count += 1; cost = Mathf.Round(baseCost * Mathf.Pow(1.12f, count)); Debug.Log("Bought 1."); } }