Assigning/accessing different scripts from the same spot in another script

Hi, I’m making a tower defence game and currently I have one generic turret controller script that all turrets will use which takes care of fire rates targeting etc. However each turret will obviously fire differently. How would I assign the different firing scripts in the one spot.

I don’t mind the different scripts functions having the same name like fire(). I was thinking something along the lines of searching through the turrets components for one the ends in fire (use a naming convention) and then assign it like that but i don’t think that’s going to work.

The games not too far started so I’m open minded to different solutions to this kind of problem that may require large changes, but i would prefer to keep one generic controlling script and one turret type specific one.

Thanks in advance

Are you familiar with inheritance? You should always consider structuring your code through inheritance if you want to make something that is a type of another thing. If you make a base Turret class, you could derive from that class for each class defining a turret type. You can then override functions from the base class, which makes it easy to change functionality while keeping the same pattern of calling methods.

Hope this answers your question.