I have several types of bad guy that may be on the screen at once. They belong to a family ("BadGuys"), and there are various conditions under which they may be destroyed. When they are destroyed, we do a few actions (animation, sound, destroy object). So, I'd like to stick those steps in a function and call that function whenever a bad guy meets a condition for destruction.
What I find is that calling BadGuy.Destroy from a function destroys all the objects in the family, rather than the one that caused the event to trigger. So, I thought I'd pass the BadGuy.UID property in as a param to my function, but I'm not really clear how I can use it on the other end to tell it to only destroy this instance rather than all of them.
Any help is appreciated!