Triggering different types of scripts within an object (READ FOR FULL EXPLANATION)

I’m trying to make a game where you go around watering flowers. Different flowers you water do different things. I’ve made a system so you can water a flower and it will bloom. But I’d like to make a system where I can have a script for all items that you can water, but once you’ve watered enough, an action in a completely different script on the same object will trigger. This script will differ depending on the type of flower.
So flower A would have a script for waterable objects that triggers one for Flower A. Flower B would have a script for waterable objects that triggers a Flower B script.

Is this possible? It seems like a better solution to me than just copying the waterable object script elements into each flower script. But that may just be the solution.

I would recommend two possible ways of doing this.

.

First option is UnityEvents, which allow you to assign a method from another script via the inspector, and then trigger that assigned method to be called with a line of code in your script. There are plenty of tutorials out there for this.

.

The other way is polymorphism. This is where in C# in general, you can create a class that inherits all it’s code from a parent class, but then certain “virtual” methods can be overridden to give different children different behaviour on child classes. In your case the parent class would be your flower, with the code for them getting watered etc, which would call an empty “virtual” method for the special behaviour when watered enough. Flower a and flower b would be child classes of flower, and would just override that one virtual method to have different behaviour. Polymorphism is a really important topic to learn about in object oriented programming, so I strongly recommend you read up on it even if you ultimately go the other route, as it’s very powerful and very useful to have in your toolbox.

Just use the strategy pattern. Its literally designed to solve this very problem.