Trying to make a timer

I’m trying to make a timer class. I don’t know a whole whole lot about C# so this may be a simple fix, or I may be going around this in the wrong way, let me know.

I’ve made it so it has its own method that takes deltaTime as an input and increases the value and does some other stuff when it reaches the target time which is given as a parameter (this method is called on Update() of the main class, could I call it in this class? Would that be more efficient?).

What I need help with is I want to be able to be able to have two methods from the main class, it would call one of them every time it updates the timer, and it would call the other when the timer reaches the target time. Mainly, I want to be able to vary these methods, so whenever I create a new instance of the timer class, I can input two parameters that correspond to methods in the main class, which translates to it calling those two methods in the way mentioned above.

Here is my code:

// paste code here :V

Can someone help me with this?

Do you want each instance of the timer class to call a different function in the main class when the timer expires? If so, then you may want to look into delegates. You can add one or more functions to a delegate, then when you call the delegate it will run all of the functions that were added.

Unity has a pretty short tutorial about delegates, but you may need to look elsewhere for more information.