Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Creating E-Learning Games with Unity

You're reading from  Creating E-Learning Games with Unity

Product type Book
Published in Mar 2014
Publisher
ISBN-13 9781849693424
Pages 246 pages
Edition 1st Edition
Languages
Author (1):
David Horachek David Horachek
Profile icon David Horachek

Table of Contents (17) Chapters

Creating E-Learning Games with Unity
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Introduction to E-Learning and the Three Cs of 3D Games 2. Interactive Objects and MissionMgr 3. Mission One – Find the Facts 4. Mission One – Future Proofing the Code 5. User Interfaces in Unity 6. NPCs and Associated Technology 7. Mission Two – Testing a Player's Learning 8. Adding Animations 9. Synthesis of Knowledge 10. An Extensible Game Framework Pattern in Unity Index

Creating the Time object


The Time object will implement the game's clock functionality in this level. If the time ever reaches zero, this class will display the mission failed pop up. Recall that the source of the added pressure this time around is the clock ticking down to zero. We want this because a little pressure makes the game fun and encourages cognitive flow. Perform the following steps to create the Time object:

  1. Create a new script named TimeScript.cs. Add an instance of it to a new GameObject of type GUIText. Place GUIText on the left-hand side of the screen opposite the score. Note, this is done by adjusting the PixelOffset field of the GUIText component, and not by moving the transform (this is one of the few exceptions to the rule when placing objects in Unity).

  2. A pixel inset of -60, -20 looks good at a screen resolution of 1024 x 768. Some of the settings for the GUIText component are shown in the following screenshot:

  3. Add the following four variables to the script:

    • public GameObject...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}