Setup the State Machine and add a Player GameObject
We're going to use a State Machine to control the game, so let's get some ideas of what we want:
- The State classes for the State Machine
- The
BeginState
class, which is a splash screen displayed when the game starts - The
SetupState
class, which provides game options - The
PlayState
classes, which are two levels of gameplay - The
WonState
classes, which show a graphic and proceed to the next level - The
LostState
classes, which show a graphic, and replay the level or restart the game - A Player GameObject
- A script to hold game data
The following Scenes and States diagram shows three Scenes and nine States that we'll use to control game flow:
As you can see from this diagram, there are five more States and another ...
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.