TimeManager

Overview

Owns pause / play / fast-forward controls and the authoritative tickTime. Exposes events to enable/disable the time UI, supports a force play flow (clears stacks), and keeps button visuals in sync. Maintains pause and disable stacks so multiple systems can request control without fighting.

Serialized Atoms & Events

  • FloatVariable tickTime, BoolVariable paused
  • VoidEvent enableTimeControls, VoidEvent disableTimeControls, VoidEvent forcePlay
  • FloatEvent changeEventMusicParameter (set to 0 on resume to normalize music state)

Gameplay Settings

  • slowTime = 0.8f, normalTime = 0.4f, fastTime = 0.2f (tick durations)

UI

  • Button pauseButton, Button playButton, Button fastButton
  • Color selectedColor, selectedPauseColor, unselectedColor

Behavior

  • Awake():
    • Register to events and paused.Changed.
    • Start paused (paused = true) and select the Pause button.
  • EnableTimeControls():
    • Decrement disable stack; when zero, enable buttons and re-select the last player choice (default Play).
  • DisableTimeControls():
    • Increment disable stack, disable play/fast buttons, select Pause.
  • SetTimeNormal()/SetTimeFast():
    • Set tickTime and paused=false, select the corresponding button, remember user choice.
  • Pause():
    • Set paused=true, select Pause.
  • ForcePlay():
    • Prime stacks, call EnableTimeControls(), set paused=false.
  • OnPauseChanged(pausing):
    • Maintains a pause stack; if any system still holds pause, re-assert pause.
    • On resume (stack cleared), raises changeEventMusicParameter(0).

Visuals

SelectButton(Button) updates ColorBlock.normalColor for selected/unselected buttons using the configured colors.