My roguelike has a main hero character, enemies and npcs. Some of their behaviours are common, such has catching on fire when walking over a fire trap. At the moment, the code to handle this is duplicated in the script file for each character’s game object. Also the fire animation has to be added separately to each game object.
Is there a way of somehow having a common game object or another way of just having one set of code and resources for these common things?