Example #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Snail snail = collision.GetComponent <Snail>();

        if (snail != null)
        {
            snail.getHit(100);
        }
        Destroy(gameObject);
    }
Example #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Snail snail = collision.GetComponent <Snail>();

        if (snail != null)
        {
            snail.getHit(25);
        }
        flyAway(collision.GetComponent <Rigidbody2D>(), this.transform.position);
    }