How store a function with var to be called later?


I’d like to call a function at one specific time in an animation, but this function can change, and the animation is always the same.

To put it simple in game logic:
Every time i want to execute an action (can be attack(power) or defend(defense))
before this action to be executed the player execute the same animation at first, and at one specific moment of the animation
I want a specific function (it can be attack(…), defense(…),etc) to be called.
It’s always the same anim, but not always the same function with different passed vars too.

I managed to do it so far with a coroutine function, but I’m not satisfied as I just rely on a timer to call my function, and if I change my animation, i’ll have to play with the delay of coroutine.

Is it possible to store a function with params into a kind of var?
like that at the point of the animation i’d launch a function that will call back the wanted function stored in this var.(with it’s args too)

Sounds like you want to learn about delegates.