Skip to content

Game Start Procedure

Note

The comments under the event invokations are the SharedObjects that need to be set before the event can be invoked.

sequenceDiagram

participant Selector as Test Level Selector

participant Bus as << Event Bus ⚡>>

Participant LFL as LevelFileLoader

Participant LG as LevelGenerator

Participant LCS as LevelColorSetter

Participant LevelReadyChecker@{ "type" : "queue" }

Note over LevelReadyChecker:This object is a MultiGameEventListener<br>awaiting multiple events before firing

Participant ComponentMovement@{ "type" : "queue" }

Participant LevelRunner



Selector-)Bus: 🔹Invoke: LevelSelected

Note over Selector,Bus: CurrentLevelIndex, CurrentChapterIndex

Bus-)LFL: 🔸Response: LevelSelected

activate LFL

LFL ->> LFL: ⠀ ⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ ⠀ LoadChapter()

LFL ->> LFL: ⠀ ⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ LoadLevel()

LFL -) Bus: 🔹Invoke: SelectedLevelFileLoaded

Note over LFL,Bus:AllChapters, CurrentChapter, CurrentLevel

deactivate LFL

Bus-)Selector: 🔸Response: SelectedLevelFileLoaded

Selector-)Bus: 🔹Invoke: GenerateLevelRequested

Note over Selector,Bus: CurrentLevel, GridSettings

Bus-)LG: 🔸Response: GenerateLevelRequested

activate LG

LG->>LG:⠀ ⠀ ⠀ ⠀ ⠀ ⠀ Generate()

LG -) Bus: 🔹Invoke: LevelGenerated

deactivate LG

Note over LG,Bus: PuzzleComponents, Tiles

Bus-)LCS: 🔸Response: LevelGenerated

activate LCS

LCS->>LCS:⠀ ⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ SetAllColors()

deactivate LCS

Bus-)LevelReadyChecker: 🔸Response: LevelGenerated

Note right of LevelReadyChecker: 🟩<br>In future we need to check <br>for way more events. <br>(CameraScaled, ColorsSet, etc)

LevelReadyChecker-)Bus: 🔹Invoke: LevelReadied

Bus-)Selector: 🔸Response: LevelReadied

Selector-)Bus: 🔹Invoke: RunLevelRequested

Bus-)ComponentMovement: 🔸Response: RunLevelRequested

activate ComponentMovement

ComponentMovement->>ComponentMovement:  ⠀⠀ ⠀ ⠀  ⠀⠀ ⠀ ⠀  ⠀⠀ ⠀ ⠀  ⠀⠀ ⠀ ⠀  ⠀⠀ ⠀ ⠀ ComponentDragger.SetActive()

ComponentMovement->>ComponentMovement:  ⠀⠀ ⠀ ⠀  ⠀⠀ ⠀ ⠀  ⠀⠀ ⠀ ⠀  ⠀⠀ ⠀ ⠀  ⠀⠀ ⠀ ⠀ ComponentMover.SetActive()

deactivate ComponentMovement

Bus-)LevelRunner: 🔸Response: RunLevelRequested

activate LevelRunner

LevelRunner->>LevelRunner:  ⠀⠀ ⠀ ⠀  ⠀⠀ ⠀ ⠀  ⠀⠀ ⠀ ⠀ LevelRunner.enable()

deactivate LevelRunner
Hold "Alt" / "Option" to enable pan & zoom

This is the current scene and what goes on to start the game.

Camera Scaler and PropPlaneGenerator stay idle but will later be incorporated in the LevelReadyChecker stack


Starting and Stopping a level simulation

sequenceDiagram

actor Player
participant Emitter
participant Bus as << Event Bus ⚡>>
participant LR as LevelRunner
Player-)Emitter:Clicked!
activate Emitter
Emitter->>Emitter:⠀ ⠀⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ ⠀ OnMouseUpAsButton()
Emitter->>Bus:🔹Invoke: LevelSimToggleRequested

Bus-)LR:🔸Response: LevelSimToggleRequested
activate LR
LR->>LR: ⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ LevelSimToggle()
alt simulating
    LR->>LR: ⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ StopLevelSimulation()
    LR->>LR: ⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ Destroy All Signals
    LR-)Bus: 🔹Invoke: LevelSimStopped
else not simulating
    LR->>LR: ⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ StartLevelSimulation()
    LR->>LR: ⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ Clear Signals SO
    LR->>LR:⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ ⠀ ⠀ ⠀⠀ ⠀ FlashUnpoweredEmitters if needed
    LR-)Bus:🔹Invoke: LevelSimStarted
    Bus-)Emitter: 🔸Response: LevelSimStarted
    Emitter->>Emitter: ⠀ ⠀⠀ ⠀ ⠀ Emit()
    deactivate Emitter
deactivate LR
end
Hold "Alt" / "Option" to enable pan & zoom