Time for action – adding the code to change the Scenes
We'll add a single line of code in BeginState
and in LostState
to change Scenes.
- In
BeginState
, addApplication.LoadLevel("Scene1");
into theSwitch()
method on line 42 as shown in the following screenshot: - In
LostState
, addApplication.LoadLevel("BeginningScene");
into theStateUpdate()
method on line 20 as shown in the following screenshot:If earlier in this chapter you changed
WonState
to switch toPlayState
instead of starting over withBeginState
, we're ready to test our State Machine again. ...
Get Learning C# by Developing Games with Unity 3D Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.