예제 #1
0
    void Update()
    {
        sw.Restart();
        TimeSpan swStart;

        UpdateTriggers();
        UpdateTimes[1] = sw.Elapsed.TotalMilliseconds;

        // Exit Sample
        if (Input.GetKey(KeyCode.Escape))
        {
            Application.Quit();
#if UNITY_EDITOR
            UnityEditor.EditorApplication.isPlaying = false;
#endif
        }

        if (Input.GetKeyDown(KeyCode.Tab))
        {
            cameraMode = !cameraMode;
            if (cameraMode)
            {
                Camera.ActivateControl();
            }
            else
            {
                Camera.DeactivateControl();
            }
        }

#if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.BackQuote))
        {
            EditorWindow window = EditorWindow.focusedWindow;
            // Assume the game view is focused.
            window.maximized = !window.maximized;
        }
#endif

        swStart = sw.Elapsed;
        UpdateMovingObjects();
        UpdateTimes[2] = (sw.Elapsed - swStart).TotalMilliseconds; swStart = sw.Elapsed;
        UpdateObjects();
        UpdateTimes[3] = (sw.Elapsed - swStart).TotalMilliseconds; swStart = sw.Elapsed;
        Timer.GameUpdate();
        UpdateTimes[4] = (sw.Elapsed - swStart).TotalMilliseconds; swStart = sw.Elapsed;
        Map.ProcessCellStateTests(10);
        UpdateTimes[5] = (sw.Elapsed - swStart).TotalMilliseconds;

        //if (!cameraMode)
        //    Character.GameUpdate();
        Camera.GameUpdate();
        sw.Stop();
        UpdateTimes[0] = sw.Elapsed.TotalMilliseconds;
    }