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:
Create a new script named
TimeScript.cs
. Add an instance of it to a new GameObject of typeGUIText
. PlaceGUIText
on the left-hand side of the screen opposite the score. Note, this is done by adjusting the PixelOffset field of theGUIText
component, and not by moving the transform (this is one of the few exceptions to the rule when placing objects in Unity).A pixel inset of
-60
,-20
looks good at a screen resolution of 1024 x 768. Some of the settings for theGUIText
component are shown in the following screenshot:Add the following four variables to the script:
public GameObject...