GameTime.Update C# (CSharp) Method

Update() private method

private Update ( ) : void
return void
    void Update()
    {
        hudTime.text = gameTime.ToString("MM/dd/yyyy    h:mm tt");
        try
        {
            gameTime = gameTime.AddSeconds(gameTimeSeconds * Time.deltaTime);
        }
        catch (System.ArgumentOutOfRangeException)
        {
            // only if( parameter_value > MaxTicks - current_ticks || parameter_value < MinTicks - current_ticks )
            hudTime.text = "Time Boundary Exception";
            Pause();
        }
    }

Usage Example

Example #1
0
 /// <summary>
 /// Primary game loop.
 /// </summary>
 public void GameLoop()
 {
     while (Running)
     {
         _resetEvent.WaitOne(1);
         FCounter.Update();
         try {
             if (WorldLoaded && GameTime != null)
             {
                 Users.Frame();
                 if (GameTime.Update())                          // every second
                 {
                     if (GameTime.TickIncrease)                  // update when enough seconds pass to increase tick.
                     {
                         Logger.Log("Updating world. Tick: {0}", GameTime.Tick.ToString());
                         Users.TickUpdate();
                         Structures.TickUpdate();
                         _taskQueue.Update();
                         Save();
                         SockServ.Broadcast("tick", GameTime.Tick.ToString());
                     }
                 }
             }
             //Net.Update();
             _taskQueue.Update();                 // run items queued during frame.
             Logger.Update();                     // print items sent to log during frame.
         }
         catch (Exception e) {
             Logger.LogError("{0}: {1}\n{2}", e.GetType(), e.Message, e.StackTrace);
         }
     }
 }
All Usage Examples Of GameTime::Update