Let's implement the GameMgr
script so that it can manage the loading (and future unloading) of scene files and assets. Implementing this in a flexible way now will make our game more extensible when we have future levels to add. It can be implemented by performing the following steps:
Recall that we have already created an empty script named
GameMgr
and attached it to theGame
GameObject. If you have not already done this, no worries; just create a new script now, and attach it.In order for
GameMgr
to do its job, it will act as a mediator betweenpopupMenu
and the scene files of the game. WhenGameMgr
receives a message to change its state, it will load and unload the appropriate scene files.It is important that at this point we have added the
LEVEL1
scene file to the build settings; if you have not yet done this, make sure it has been added now.We will use a custom enumeration in this class to build a state machine. This is a data structure that will let us...