Exemplo n.º 1
0
    void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.tag != "Checkpoint" && other.gameObject.tag != "Player")
        {
            if (other.gameObject.tag == "Enemy")
            {
                TakeDamage hit = other.collider.GetComponent <TakeDamage> ();

                if (hit != null)
                {
                    hit.Damage(1);
                }
                Instantiate(Effect, transform.position, transform.rotation);
            }
            Destroy(gameObject);
        }
    }