예제 #1
0
        // -------------------------- fps counter

        /*
         *  private int _frameCounter = 0;
         *  private float _timeCounter = 0.0f;
         *  private float _lastFramerate = 0.0f;
         *  private float _refreshTime = 0.5f;
         *
         *  private void CalcFPS()
         *  {
         *      if (_timeCounter < _refreshTime)
         *      {
         *          _timeCounter += Time.deltaTime;
         *          _frameCounter++;
         *      }
         *      else
         *      {
         *          _lastFramerate = _frameCounter / _timeCounter;
         *          _timeCounter = _frameCounter = 0;
         *
         *          Common.Log("FPS: " + _lastFramerate);
         *      }
         *  }
         *
         *  void Update()
         *  {
         *      CalcFPS();
         *  }
         *
         */

        void Start()
        {
            SetCommonData();
            StartCoroutine(_mainService = _service(Constants.BackgroundTimer));

            InitGameMatrix();
            InitGameCarSystem();        // coroutines to control cars system
            InitGameEconomySystem();    // coroutines to control economy and houses level

            if (!JsonSerializer.HasSave())
            {
                ConfigureNewGame();
            }
            else
            {
                SerializaCity.OpenSave((SerializableCity)JsonSerializer.Get <SerializableCity>());
            }
        }
예제 #2
0
 public void ExitGame()
 {
     JsonSerializer.Save(SerializaCity.GetSave());
     Application.Quit();
 }