void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Slime")) { shake.Shaker(0.125f, 0.125f); other.GetComponent <Slime>().Death(); } else if (other.CompareTag("Gold")) { shake.Shaker(0.125f, 0.125f); other.GetComponent <Gold>().Death(); } }
public void Death() { spawner.startTimeBtwSpawns = spawner.startTimeBtwSpawns + spawner.decrement; shake.Shaker(0.125f, 0.125f); Instantiate(effect, transform.position, Quaternion.identity); Destroy(gameObject); }