Exemplo n.º 1
0
    public void Update()
    {
        CurTime = Time.realtimeSinceStartup;
#if UNITY_EDITOR
        if (!EditorApplication.isPlaying)
        {
            if (!EditView)
            {
                return;
            }
            CurTime = EditorApplication.timeSinceStartup;
            if (!CheckEditModeInited())
            {
                ResetEditScene();
            }
        }
#endif
        float deltaTime = (float)(CurTime - LastTime);

        //simple method to check game delay: the game must run above 20 FPS.
        if (deltaTime > 0.05f)
        {
            deltaTime = 0.0333f;
        }

        if (!IgnoreTimeScale)
        {
            deltaTime *= Time.timeScale;
        }

        ElapsedTime += deltaTime;

        for (int i = 0; i < EflList.Count; i++)
        {
            if (EflList[i] == null)            //be destroyed?
            {
                return;
            }
            EffectLayer el = EflList[i];
            if (ElapsedTime > el.StartTime && IsActive(el.gameObject))
            {
                el.FixedUpdateCustom(deltaTime);
            }
        }


        for (int i = 0; i < EventList.Count; i++)
        {
            XftEventComponent e = EventList[i];
            if (IsActive(e.gameObject))
            {
                e.UpdateCustom(deltaTime);
            }
        }

        LastTime = CurTime;

#if UNITY_EDITOR
        if (!EditorApplication.isPlaying)
        {
            LateUpdate();
        }
#endif
    }