Game Development Reference
In-Depth Information
PlayerData : This script will hold the game instance-specific attributes of
the player. This will include variables such as score and current level.
Game : This is the GameObject that holds the scripts necessary for game con-
trol. It will hold the GameMgr script as well as the MissionMgr script.
_level1 : This class will hold all of the objects that are specific to the first
level.
_global : This class will hold all of the objects that are global or persistent
across all game levels as shown in the following screenshot:
Taking an already working system of code and reworking it so that it is more extend-
ible is called Refactoring . By refactoring our game into a number of scene files, we
will find that the game becomes easier to extend and maintain. This is important for
us to be able to add new lessons and levels to the game.
Previously, our approach to game programming in Unity was to place all GameOb-
ject instances inside one scene file. This worked because the lifespan of all
GameObjects was the same—the duration of the whole program.
In a multilevel game, we will want to keep some objects persistent for the entire
lifespan of the program. Other objects, we will want to only use during a particular
level, and perhaps we may want some objects only fleetingly during a particular level.
Let's separate our work thus far into two scene files: one for persistent objects and
one for level-one-specific objects.
Search WWH ::




Custom Search