Important Notice:

On July 31st, 2017 the Digital-Tutors library will be retired along with Digital-Tutors concurrent licensing. Effective August 1, 2017 any active group plans will be redirected to www.pluralsight.com. Each group plan will receive one individual user license on Pluralsight for each paid Digital-Tutors license. Please contact your account representative for any additional questions.
Unity Mobile Game Development: Game State
See Details
Released Feb 1, 2012
Chris Glick

Pluralsight

Chris Glick
In this Unity tutorial, we’ll learn how to code a game's state or logic to keep track of things like timers, kills and rounds. Through these lessons, we’ll examine our game design doc and build game-play functionality. We'll begin with creating a simple count-down timer and how to let other scripts cleanly access it. Then we'll learn how to start and end our game with a splash screen to hide the level. Next we'll create functions for the various parts of a game, like winning a round, pausing the game, killing an enemy, saving our data, resetting our game, and game over. Finally we'll take a quick look at randomly spawning our player. A game's internal logic is one of the most important parts of any game's development. By learning how to deal with many common game states, we can extend them to fit our own game's needs.
Introduction and project overview
1

Introduction and project overview

 
01:05
Examining our start scene and the scripts that are included
2

Examining our start scene and the scripts that are included

 
02:37
Consulting our game design document to begin our script
3

Consulting our game design document to begin our script

 
05:15
Coding our Timer and counting down in the Update function
4

Coding our Timer and counting down in the Update function

 
07:04
Using Get functions to let other scripts access our variables
5

Using Get functions to let other scripts access our variables

 
07:51
Connecting our Render Overlay script component
6

Connecting our Render Overlay script component

 
06:57
Adding Update logic to turn the overlay on and off
7

Adding Update logic to turn the overlay on and off

 
04:13
Beginning the Won Round function
8

Beginning the Won Round function

 
08:00
Using Yield to pause our script execution for a second
9

Using Yield to pause our script execution for a second

 
06:43
Listening for pausing and adding pause functionality
10

Listening for pausing and adding pause functionality

 
07:49
Coding our EnemyKilled function with data checking
11

Coding our EnemyKilled function with data checking

 
09:04
Creating a function to save all of our stats after a round
12

Creating a function to save all of our stats after a round

 
07:36
Coding a GameOver function to load another level
13

Coding a GameOver function to load another level

 
10:37
Creating a reset function to start at round one
14

Creating a reset function to start at round one

 
09:06
Moving the player to a random location
15

Moving the player to a random location

 
09:16
Randomly placing the player in the level based on waypoints
16

Randomly placing the player in the level based on waypoints

 
08:04
Cleaning up the WonRound and adding a random spawn toggle
17

Cleaning up the WonRound and adding a random spawn toggle

 
06:16