예제 #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        playerScript ply = other.gameObject.GetComponent <playerScript>();

        if (ply == null)
        {
            return;
        }
        if (!ply.invincible)
        {
            if (other.gameObject.CompareTag("player"))
            {
                ply.TakeHit();
                //Destroy(other.gameObject);
                Destroy(this.gameObject);
            }
        }
    }