Reader small image

You're reading from  Unity Game Development Essentials

Product typeBook
Published inOct 2009
Reading LevelIntermediate
PublisherPackt
ISBN-139781847198181
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Will Goldstone
Will Goldstone
author image
Will Goldstone

Will Goldstone is a longstanding member of the Unity community and works for Unity Technologies as a Technical Support Associate, handling educational content and developer support. With an MA in Creative Education, and many years experience as a lecturer in higher education, Will wrote the first ever Unity book, the original Unity Game Development Essentials, and also created the first ever video tutorials for the package. Through his sites http://www.unity3dstudent.com and http://learnunity3d.com Will helps to introduce new users to the growing community of developers discovering Unity every day.
Read more about Will Goldstone

Right arrow

Game win notification


As a final finishing touch, we'll tell the player that they have successfully won the game when the fire has been lit, as this is the goal of our game.

Open the PlayerCollisions script in the Scripts folder of the Project panel, and scroll to the bottom. The last function in the script is lightFire() and into this we'll add some more commands before its terminating right curly brace. Move down a couple of lines from the current last line:

Destroy(GameObject.Find("matchGUI"));

And place in the following commands:

TextHints.textOn=true;
TextHints.message = "You Lit the Fire, you'll survive, well done!";
yield new WaitForSeconds(5);
Application.LoadLevel("Menu");

Here we're switching back on our TextHints GUI from earlier, and sending the message "You Lit the Fire…" as the string of text to display on screen. We then use a yield command to halt the script for 5 seconds, and then load the Menu level of the game, so that the player may play again.

Now press the Play button,...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Unity Game Development Essentials
Published in: Oct 2009Publisher: PacktISBN-13: 9781847198181

Author (1)

author image
Will Goldstone

Will Goldstone is a longstanding member of the Unity community and works for Unity Technologies as a Technical Support Associate, handling educational content and developer support. With an MA in Creative Education, and many years experience as a lecturer in higher education, Will wrote the first ever Unity book, the original Unity Game Development Essentials, and also created the first ever video tutorials for the package. Through his sites http://www.unity3dstudent.com and http://learnunity3d.com Will helps to introduce new users to the growing community of developers discovering Unity every day.
Read more about Will Goldstone