Beispiel #1
0
 /// <summary>
 /// Function to update the current stats of the game.
 /// Is updated on every paint method.
 /// </summary>
 private void updateStatsFunc()
 {
     if (frameRateLabel.InvokeRequired)
     {
         updateStats fr = updateStatsFunc;
         this.Invoke(fr, new object[] { });
     }
     else
     {
         lock ( worldInfo )
         {
             Cube playerCube = worldInfo.getCubeById(playerCubeUid);
             if (playerCube != null)
             {
                 frameRateLabel.Text = "FPS: " + lastFrameRate;
                 massLabel.Text      = "Mass: " + (int)playerCube.mass;
                 widthLabel.Text     = "Width: " + (int)playerCube.width;
                 foodLabel.Text      = "Food: " + worldInfo.getFoodCount();
             }
         }
     }
 }
Beispiel #2
0
 void Start()
 {
     inv    = GameObject.Find("Inventory").GetComponent <Inventory>();
     update = GameObject.Find("Inventory").GetComponent <updateStats> ();
     InvokeRepeating("healthManaRegen", 1, 3);
 }