The next method will activate/deactivate layers, depending on the game mode we give in as the parameter.
ActivateLayer
to the game
class. As a parameter, it will take the game mode as an INT value.Method ActivateLayer:Int(mode:Int) Deactivate ALL layers. layerBackground.SetActive(False) layerGame.SetActive(False) layerGFX.SetActive(False) layerGameOver.SetActive(False) layerMenu.SetActive(False) layerScore.SetActive(False) layerTitle.SetActive(False)
Select
statement with the variable mode
as the expression.Select mode
gmPlay
constant. If it's true, activate the background, game, and GFX layers.Case gmPlay layerBackground.SetActive(True) layerGame.SetActive(True) layerGFX.SetActive(True)
gmGameOver
constant. If it's true, activate the background, game, GFX, and the GameOver
layers.Case gmGameOver layerBackground.SetActive(True) layerGame.SetActive(True) layerGFX.SetActive(True) layerGameOver.SetActive(True)
gmMenu
constant is true, activate the menu layer.Case gmMenu layerMenu.SetActive(True)
gmScore
constant and activate the score layer if it's true.Case gmScore layerScore.SetActive(True)
gmTitle
constant. Again, if it's true, activate the title layer.Case gmTitle layerTitle.SetActive(True)
Select
statement and the method.End Return 0 End
3.145.109.8