This is a simple script which transforms bullets when the emitter that fired them is destroyed (typically when an enemy/player dies).
In this example we made sure to [A]
reference the namespace that all shots belong to. [B]
inherit from one of the existing shot classes. [C]
Override the base Update() and implement our own procedure after all base Update() methods have been called. [D]
Call the OnEmitterDestroyedOnce() event that fires once after the emitter has been destroyed, and pass in a custom procedure. [E]
Call RePoolOrDestroy() directly to perform cleanup, destroying the unwanted bullets.
The resulting behavior instantiates the Coin prefab, producing the effect of turning the shots into collectible items when the enemy is destroyed.