Yep, you've got the hang of it, but you don't want it colliding with EVERYTHING, thats why we avoid "on hit event". on hit event collects data on ANY hit, to be more efficient, AND more accurate, limit what the raycast is looking for. So player is a tag, after your raycast add a compare tag action with player as the tag. Directly after that make another compare tag for asteroid, then after that make another one for planet. What happens after you get a hit from one of these tags is up to you.But things that take continuous damage will be a loop. Make it explode, make the ray end, make it take damage. But it will only respond to tags. Also l like i said, if your taking hit point data, you probably also want normal data. Hit point sets the position of a particle effect, normal essentially sets the rotation of an effect.
As far as a loop goes yes, but on the raycast compare tag, you can add a reaction to asteroids, player, enemy, any object that could be hit by that ray, you add them by compare tag "different tag" ( a seperate compare tag action, still on every frame) things that lose damage, give them a delay, things that explode instantly, don't need a delay, just change their tag to something the raycast isn't looking for and it will be ignored (exploded is what i have used in the past) once player reaches zero health get it to explode at the same time you tag it exploded, the rays will no longer detect it.