private void OnTriggerEnter2D(Collider2D collision) { Snail snail = collision.GetComponent <Snail>(); if (snail != null) { snail.getHit(100); } Destroy(gameObject); }
private void OnTriggerEnter2D(Collider2D collision) { Snail snail = collision.GetComponent <Snail>(); if (snail != null) { snail.getHit(25); } flyAway(collision.GetComponent <Rigidbody2D>(), this.transform.position); }