Hi all. I’m working on a RTS-ish game. I want units to Update differently according to whether they are moving around, performing an ability or idle.
I thought I was being super clever by just turning Update into a wrapper function that called a delegate. I could then change the delegate function to update the unit in a state appropriate way. I then read an article that said delegates can be slow. sicklebrick.com is almost here!
So is there a method that is commonly acknowledged as better for handling state specific actions? Should I attach state components and enable/disable them as necessary? Should I just make a big if else wrapper in my Update function that calls state specific update functions?
Cheers