Time for action – preparing the clock code

Let's rough in a few empty functions and three variables that we'll need to make the clock work.

  1. Open up the ClockScript by double-clicking on it. Update the code:
    #pragma strict
    var clockIsPaused : boolean = false;
    var startTime : float; //(in seconds)
    var timeRemaining : float; //(in seconds)
    function Awake()
    {
    }
    
    function Update() {
      if (!clockIsPaused)
      {
         // make sure the timer is not paused
         DoCountdown();
      }
    }
    
    function DoCountdown() {
    }
    
    function PauseClock()
    {
       clockIsPaused = true;
    }
    function UnpauseClock()
    {
       clockIsPaused = false;
    }
    
    function ShowTime()
    {
    }
    
    function TimeIsUp()
    {
    }
    

What just happened – that's a whole lotta nothing

Here, we've created a list of functions that we'll probably need ...

Get Unity 4.x Game Development by Example 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.