Hi all.
I’m currently penning out a spell system and I’m running into an issue: A lot of my spells have animations and camera movements that need to wait on the previous to be in place before starting.
Example:
-> Move camera
-> Once that's done start doing a part of the spell
-> Now trigger an event
-> Then pan camera to another unit
-> Have them do something
-> Once they're done doing something, pan camera again
ect ect.
And I’m planning on making a lot of different and unique spells. All of them share the same basic camera movements - just not always in the same order, or same event triggers/data changes. The coroutine ladder is making it difficult to organize a good modular system with re-usuable functions. As it stands, for each spell I’ll have to re-write the entire ladder start to finish, each calling up slightly different functions inside the script. What’s a good setup to avoid making this giant mess?
The current solution I’m thinking of is to make my spells individual scripts, and have their calls in the update function. Then I can use bools to trigger different functions instead of coroutine. Re-usuable functions are stored in some master-list function. This sounds like it would work but feels very hacky. Additionally I don’t think I can serialize a list of different scripts, so having easy unit creation using SO’s where I can just drag and drop the different spells they can use would go out the window.