So the big new addition to the system is Impact Handler. Impact Handler is sort of a super Object Pool Handler in that it contains references to n Object Pools where n is the number of Impact materials that we are dealing with. For this demo, there are two Impact materials: Flesh and not flesh.
Flesh is an empty script that I can attach to objects that should play squishy sounds when they are shot. It might not stay empty, but it’s empty for now. I envision that there could be other Impact material scripts to play different sounds.
The Raycast To Target component gets a second event that sends three outputs into the void to be intercepted by who knows what. In this case that would be the Impact Handler component. The event outputs are (1) the collider of the object the raycast hit, (2) the world position of the hit, and (3) the surface normal of the hit. If you scan back up to the Impact Handler code, you can see that the surface normal is used to generate a Quaternion to align the Impact FX properly.
Raycast To Target didn’t really have significant code changes. There is the addition of the Impact Event class and then its invocation. Do note that the Impact event is invoked for all hits, not just Target hits.