Gameplaytoplevelsm Pseudocode
Gameplaytoplevelsm Pseudocode
CurrentState is Waiting
Set ReturnEvent equal to CurrentEvent equal to return of
DuringWaiting()
If CurrentEvent.EventType is not equal to ES_NO_EVENT
ThisEvent is START_STARTING
Set NextState equal to Starting
Set MakeTransition equal to true
ThisEvent is START_PREPARING
Set NextState equal to Starting
Set MakeTransition equal to true
ThisEvent is START_EXECUTING
Set NextState equal to Starting
Set MakeTransition equal to true
EndIf
End Waiting block
CurrentState is Starting
Set ReturnEvent equal to CurrentEvent equal to return of
DuringStarting()
If CurrentEvent.EventType is not equal to ES_NO_EVENT
ThisEvent is STOP_STARTING
Set NextState equal to Waiting
Set MakeTransition equal to true
ThisEvent is GAME_ENDED
Set NextState equal to Waiting
Set MakeTransition equal to true
Call EndGame()
EndIf
End Starting block
CurrentState is Preparing
Set ReturnEvent equal to CurrentEvent equal to return of
DuringPreparing()
If CurrentEvent.EventType is not equal to ES_NO_EVENT
ThisEvent is STOP_PREPARING
Set NextState equal to Waiting
Set MakeTransition equal to true
ThisEvent is GAME_ENDED
Set NextState equal to Waiting
Set MakeTransition equal to true
Call EndGame()
EndIf
End Preparing block
CurrentState is Executing
Set ReturnEvent equal to CurrentEvent equal to return of
DuringExecuting()
If CurrentEvent.EventType is not equal to ES_NO_EVENT
ThisEvent is STOP_EXECUTING
Set NextState equal to Waiting
Set MakeTransition equal to true
ThisEvent is GAME_ENDED
Set NextState equal to Waiting
Set MakeTransition equal to true
Call EndGame()
EndIf
End Executing block
Return ReturnEvent
End of RunGameplayTopLevelSM
StartGameplayTopLevelSM
Takes CurrentEvent as parameter, returns nothing.
End of StartGameplayTopLevelSM
DuringWaiting
Takes Event as parameter, returns Event.
If Event is ES_ENTRY
Endif
Endif
Else
EndElse
Return Event
End of DuringWaiting
DuringStarting
Takes Event as parameter, returns Event.
If Event is ES_ENTRY
Call StartStartingSM with Event
Endif
Else
Set Event equal to return of call to RunStartingSM with
parameter Event
EndElse
Return Event
End of DuringStarting
DuringPreparing
Takes Event as parameter, returns Event.
If Event is ES_ENTRY
Call StartPreparingSM with Event
Endif
Else
Set Event equal to return of call to RunPreparingSM with
parameter Event
EndElse
Return Event
End of DuringPreparing
DuringExecuting
Takes Event as parameter, returns Event.
If Event is ES_ENTRY
Call StartExecutingSM with Event
Endif
Else
Set Event equal to return of call to RunExecutingSM with
parameter Event
EndElse
Return Event
End of DuringExecuting
EndGame
End of EndGame