I'm trying to create some interesting variations on timescales in my game. In essence, I'd like at least two, probably three or four separate timescales.
The player - the player timescale is likely to be the game/scene timescale always.
Mobs - mob timescales can be altered (slower primarily, but also faster possibly) depending on cast spells or other effects in the game.
Environment - like mobs, the environment may be slowed or sped up depending on some game effects that occur. This would control things like traps, torches, etc.
I'm thinking about things such as a Slow Time spell that might slow most mobs, but maybe not others (bool flag), something like a time elemental or something of that nature. I'd also like to possibly slow environmental time so the player may have a single-use item that would allow them to move easily navigate traps (but not have guaranteed success if they still don't see the pattern or such).
Having controller scripts that are added to all objects that listen for calls to change a multiplier on
Time.deltaTime could be an option, but it's clunky, would have to be in all of the scripts, would have to be accounted for in many areas (movement, combat, possibly related effects), and is just not an ideal option.
Inversely, the same effect (a lich for example casting slow on a player) could require opposing things. If I had global settings that contained a multiplier for player/mob/object that were impacted by an effect, I could still always use a multiplier with
Time.deltaTime, but I still think it would be clunky.
Has anyone done this? Are there any good ideas? I've searched a bit, but didn't find anything terribly useful.
I've considered custom
Update() classes, though I'm not entirely sure how to implement them. Maybe extend the
FixedUpdate() class that's built in to take other things into account? I know that
Time.timeScale is inherently for the current scene, but could I make instances of
Time that are used by different scripts
FixedUpdate()? Am I overthinking this? I feel like this shouldn't be quite so difficult.