public virtual void Destroy() { gameObject.SetActive(false); GameObject deathEffect = Instantiate(deathFX, transform.position, Quaternion.identity); GameObject droppedItem = newItem.GetRandomItem(); if (droppedItem != null) { Instantiate(droppedItem, transform.position, Quaternion.identity); } Destroy(deathEffect, 1f); }
public void Destroy() { anim.SetBool("Destroyed", true); Invoke("Disable", 2f); if (contents != null) { SpawnItem(contents); } else { GameObject droppedItem = newItem.GetRandomItem(); if (droppedItem != null) { SpawnItem(droppedItem); } } }