Game Development Reference
In-Depth Information
• On the first element of the actions array, set the action to
EnableOb-
ject
and the object reference to
setupLevel2
(a new GameObject
parented to
_level2
). This object will set up the mission once it is in-
stantiated.
• On the second element of the actions array, set the action to
En-
ableObject
and the object reference to
raceStarter
(a new GameOb-
ject parented to
_level2
). This object will commence the start-up of
the racers themselves, resulting in their starting to run.
• On the third element of the actions array, add a
SelfDestruct
action
so that the last task the button does is to destroy the panel itself.
4. Create a new Prefab named
popup_Level2Finish
from the
popup_info
Prefab, which we created in
Chapter 5
,
User Interfaces in Unity
.
5. Change the five lines of text on the Prefab to present a nice message to the
user for winning the game. This panel will be enabled when the user wins the
race with 100 percent accuracy.
6. Give the
confirm
button two actions:
LoadLevel3
and
SelfDestruct
. This
will result in the button loading the next level and then destroying itself. In
Chapter 10
,
An Extensible Game Framework Pattern in Unity
, we will con-
nect this pop-up window to the
GameMgr
class when we integrate the level
transitions together.
7. Create a new Prefab named
popup_Level2Repeat
from the
popup_info
Prefab, which we created in
Chapter 5
,
User Interfaces in Unity
.