Example #1
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        float y_pos = transform.position.y;

        //プレイヤーとの当たり判定
        if (collision.gameObject.tag == "Player")
        {
            Player.destroyedCount += 1;
        }
        //弾が当たったらHpが減る
        if (y_pos < 5.4)
        {
            if (collision.gameObject.tag == "Playerprojectile")
            {
                AudioSource.PlayClipAtPoint(BossDamagedSE, transform.position);
                hp.HpDown(gameObject);
                Destroy(collision.gameObject);
            }
        }
    }