// Pickup gem, hide it, player sound, then delete IEnumerator PickupThis() { // Increment count runeCount.PickedUpRune(type); // Deactivate this gem GetComponent <SpriteRenderer>().enabled = false; GetComponent <BoxCollider2D>().enabled = false; // Play sound GetComponent <AudioSource>().Play(); yield return(new WaitForSeconds(2f)); Destroy(this.gameObject); }
// Invoked when the delete button is clicked public void DeleteRune() { // Delete the tile icon Destroy(selRune.icon); // Remove the currently selected rune from the list placedRuneList.Remove(selRune); // Let RuneCount know we deleted one rc.PickedUpRune(selRune.rune.type); // Call the delete function for the rune selRune.rune.DestroyRune(); // Hide the slider and delete button deleteButton.gameObject.SetActive(false); rotationSlider.gameObject.SetActive(false); // Unselect this tile selRune = new PlacedRune(null, new Vector2(0f, 0f), 0f, 0f, 0f, null); selected = false; lastClickTile = new Vector2(0f, 0f); }