void OnTriggerEnter2D(Collider2D collider) { if ((collider.gameObject.tag == "Enemy") || (collider.gameObject.tag == "EnemyS") || (collider.gameObject.tag == "Eshot")) { Hp = Hp - playerHit.damage; slider.value = (float)playerHit.hp / (float)playerHit.hpMax; } if (collider.gameObject.tag == "HPItem") { playerHit.AddHP(reward); slider.value = (float)playerHit.hp / (float)playerHit.hpMax; } }