Example #1
0
    void Update()
    {
        if (inputController == null)
        {
            return;
        }


        if (!gameWorld.IsPaused)
        {
            inputController.ProcessInput();

            // make dTs deterministic
            accumulatedTime += Time.deltaTime;
            while (accumulatedTime >= DeterministicTick)
            {
                gameWorld.Tick(DeterministicTick);
                accumulatedTime -= DeterministicTick;
            }
        }

        // update view stuff.
        viewController.Render();
        uiController.OnUpdate();
        cameraController.CameraUpdate();

        // restars level.
        if (Input.GetKey(KeyCode.R))
        {
            Game.LoadLevel(levelData);
        }

#if UNITY_EDITOR
        if (Input.GetKey(KeyCode.F12))
        {
            Game.LoadNextLevel(levelData);
        }
#endif
    }