darkbeer
Beer is Good!
- Reaction score
- 84
Hey,
just want to ask what is the best way to store a function, so i can execute it later
heres an example of what i mean^^
lets say i made i missile system for spells, so if a unit cast a spell called fireball it will create a dummy and moves it to the target using a timer, now if anything is in the way (other unit, trees ....) the ball will execute a function MyFunc that deals aoe damage and casts another spell on all units in the area.
So now i want to do the same with an iceball, so i just need to change the executed function to MyFunc2, to do other things.
but how do i execute a function giving it arguments and how should i know which function to execute, im using a struct, so i might should use methods, (i heard sth about interfaces being usefull at such things)
maybe someone has a better idea than me^^ thx in advance
just want to ask what is the best way to store a function, so i can execute it later
heres an example of what i mean^^
lets say i made i missile system for spells, so if a unit cast a spell called fireball it will create a dummy and moves it to the target using a timer, now if anything is in the way (other unit, trees ....) the ball will execute a function MyFunc that deals aoe damage and casts another spell on all units in the area.
So now i want to do the same with an iceball, so i just need to change the executed function to MyFunc2, to do other things.
but how do i execute a function giving it arguments and how should i know which function to execute, im using a struct, so i might should use methods, (i heard sth about interfaces being usefull at such things)
maybe someone has a better idea than me^^ thx in advance