コード例 #1
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Player")
        {
            HealthScriptForPlayer3 _health3 = collision.gameObject.GetComponent <HealthScriptForPlayer3>();

            _health3.TakeDamagee(damageamount);
        }
    }
コード例 #2
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        //if (collision.gameObject.tag == "Enemy" || collision.gameObject.tag == "Player")
        if (collision.gameObject.tag == "Player")
        {
            HealthScriptForPlayer3 _health3 = collision.gameObject.GetComponent <HealthScriptForPlayer3>();

            _health3.TakeDamagee(damageamount);

            Destroy(gameObject);
        }
    }