public void Tapped() { if (alreadyTapped) { return; } alreadyTapped = true; AmtGiven = Random.Range(2, 4); TypeGiven = Random.Range(0, IM.seeds.Length); giftCanvas.SetActive(true); for (int i = 0; i < AmtGiven; i++) { IM.AddSeed(IM.seeds[TypeGiven].name); } IslandScript island = WorldManager.Instance.SelectedIsland.GetComponent <IslandScript>(); if (island.currentCreaturePopulation < island.maxCreaturePopulation) { GameObject newEgg = Instantiate(IM.eggs[Random.Range(0, IM.eggs.Length)].objectToSpawn, this.transform.position, Quaternion.identity); } ItemPreview.GetComponent <Image>().sprite = IM.seeds[TypeGiven].sprite; ItemPreview.GetComponentInChildren <Text>().text = "x" + AmtGiven; this.GetComponent <Animator>().SetTrigger("Open"); }
public void Purchase() { if (inventory.Coins < 10) { return; } inventory.UseCoins(10); inventory.AddSeed(); button.interactable = (inventory.Coins >= 10); }