コード例 #1
0
    IEnumerator activeSkillMaxEffect()
    {
        int index = 0;

        spFeverBackground.spriteName = activeFeverIds[index];
        spFeverBackground.enabled    = true;

        while (true)
        {
            if (state != State.Ready)
            {
                spFeverBackground.enabled = false;
                break;
            }
            else if (coolTime.Get() > 0)
            {
                spFeverBackground.enabled = false;
                break;
            }

            yield return(Util.ws008);

            ++index;

            if (index > 12)
            {
                index = 0;
                spFeverBackground.spriteName = activeFeverIds[index];
                spFeverBackground.enabled    = true;
            }
            else if (index > 7)
            {
                if (index == 8)
                {
                    spFeverBackground.enabled = false;
                }
            }
            else
            {
                spFeverBackground.spriteName = activeFeverIds[index];
            }
        }
    }
コード例 #2
0
    void Update()
    {
#if UNITY_EDITOR
        if (stageManager.isIntro)
        {
            if (Input.GetMouseButtonDown(2))
            {
                Time.timeScale = 10.0f;
            }
            else if (Input.GetMouseButtonUp(2))
            {
                Time.timeScale = 1.0f;
            }
        }
#endif


//		Debug.Log("timescale: " + Time.timeScale);


        if (_waitForTouchToStartGame && Input.GetMouseButtonUp(0))
        {
            _waitForTouchToStartGame = false;
            closeTitleAndPlayGame();
        }


        if (uiManager.uiLoading.gameObject.activeInHierarchy == true && recordMode != RecordMode.continueGame && _openContinuePopup == false)
        {
            return;
        }

#if UNITY_EDITOR
        if (Input.GetKeyUp(KeyCode.Q))
        {
            Time.timeScale -= 0.1f;
        }
        else if (Input.GetKeyUp(KeyCode.W))
        {
            Time.timeScale *= 2.0f;
        }
        else if (Input.GetKeyUp(KeyCode.S))
        {
            Log.saveFileLog();
        }
#endif
        if (Time.smoothDeltaTime <= 0.0f || Time.timeScale <= 0)
        {
            globalDeltaTime = 0.0f;
            if (stageManager.isIntro)
            {
                cutSceneManager.updateFrame();
            }
            return;
        }

        if (uiManager.currentUI != UIManager.Status.UI_PLAY)
        {
            if (uiManager.currentUI == UIManager.Status.UI_MENU)
            {
//				checkAutoLandScape();
            }

            LOOP_INTERVAL.Set(Time.smoothDeltaTime);
            _loopType = LoopType.preview;
            if (Time.frameCount % 500 == 0)
            {
                System.GC.Collect();
            }
            if (Time.frameCount % 3600 == 0)
            {
                clearMemory();
            }
        }
        else
        {
            if (_isPaused)
            {
                if (Time.frameCount % 30 == 0)
                {
                    System.GC.Collect();
                }
                return;
            }

            _loopType = LoopType.inGame;


            LOOP_INTERVAL.Set(0.05f);               ////(1.0f/20.0f); // 초당 20번 연산.

            if (isAutoPlay == false && BattleSimulator.nowSimulation == false)
            {
                player.moveState = Player.MoveState.Stop;
            }

            if (recordMode == RecordMode.record && isPlaying)
            {
                checkPlayerTouchForMove();
            }
        }

        float newTime   = currentTime + Time.smoothDeltaTime;      //((float)(Mathf.RoundToInt(Time.smoothDeltaTime*100.0f))*0.01f);
        float frameTime = newTime - currentTime;

        if (frameTime > LOOP_INTERVAL * 10.0f)
        {
            frameTime = LOOP_INTERVAL * 10.0f;
        }

                #if UNITY_EDITOR
        if (BattleSimulator.nowSimulation &&
            BattleSimulator.instance.skipTime > 0 &&
            BattleSimulator.instance.skipTime > LOOP_INTERVAL)
        {
            frameTime = BattleSimulator.instance.skipTime;
        }
                #endif

        //if(playMode == Play_Mode.REPLAY) frameTime = 10.0f;
        if (recordMode == RecordMode.continueGame)
        {
            frameTime = 30.0f;
        }

        currentTime.Set(newTime);
        _updateLoopLeftTime.Set(_updateLoopLeftTime.Get() + frameTime);

        float useLoopUpdateTime = 0.0f;

        loopIndex = 0;

        while (_updateLoopLeftTime >= LOOP_INTERVAL)
        {
            globalDeltaTime = LOOP_INTERVAL;            //Time.smoothDeltaTime;//Time.smoothDeltaTime;	//LOOP_INTERVAL;
            updateLoop();
            globalGamePassTime += globalDeltaTime;
            useLoopUpdateTime  += globalDeltaTime;
            _updateLoopLeftTime.Set(_updateLoopLeftTime - globalDeltaTime);

            if (stageManager.isIntro)
            {
#if UNITY_EDITOR
                Debug.Log("intro loop : " + _updateLoopLeftTime);
#endif

                cutSceneManager.updateFrame();

                if (Time.timeScale <= 0)
                {
                    _updateLoopLeftTime = 0;
                }
            }

            ++loopIndex;
        }

        if (useLoopUpdateTime > 0)
        {
            renderSkipFrame = false;
        }
        else
        {
            renderSkipFrame = (isPlaying && uiManager.currentUI == UIManager.Status.UI_PLAY);
        }

        renderRatio = _updateLoopLeftTime / LOOP_INTERVAL;

        render();

        globalTime = Time.realtimeSinceStartup;
    }