Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        // 感染開始後の処理 //
        if (isStartPandemic == false)
        {
            return;
        }

        // クリアしたかの判定
        isClear = GameObject.FindGameObjectWithTag("Actor") == null;

        // 全ステージクリアした
        // スコアの代入はここで
        if (stageMnager.AllClear)
        {
            if (stayTime <= 0.0f)
            {
                clearPanelUI.SlideOut();

                if (stayTime == 0.0f)
                {
                    if (isClear)
                    {
                        audio.PlayOneShot(clearSE);
                    }
                    else
                    {
                        audio.PlayOneShot(gameOverSE);
                    }
                }
            }
            stayTime += Time.deltaTime;
            if (stayTime >= 5.0f)
            {
                score = GetClearTime();
                saveStr.SetResultScore(score);
                UnityEngine.SceneManagement.SceneManager.LoadScene("RankingScene");
                stayTime = 0;
            }
        }
        else if (isClear)
        {
            stageNum++;
            if (stageNum > 3)
            {
                stageNum = 3;               // 拡張不可
            }
            //infectedNum = 0;
        }

        if (isClear)
        {
            screenCntrol.SetStageNum(stageNum);
            pandemicFlag = false;
            comboScript.Initialize();
            screenCntrol.ChengePandemicTextColor(0.0f, 0.0f, 0.0f, isClear);
        }

        // クリア前の処理
        if (IsClear())
        {
            return;
        }

        // パンデミック時とステージ移動中はタイムを止める
        if (!pandemicFlag && stageMnager.MigrationStage)
        {
            time -= Time.deltaTime;// * acceleratorRate;
            if (time < 0.0f)
            {
                time = 0.0f;
            }
        }

        actorNum = WorldViewer.CountObjects("Actor");
        //感染率が80%以上ならパンデミック開始
        if (!pandemicFlag)
        {
            // ゾンビ数を取得
            int infectedNum = WorldViewer.CountObjects("InfectedActor");
            if ((float)infectedNum / (actorNum + infectedNum) * 100.0f >= perdemic)
            {
                // パンデミック発動キーが押された
                if (Input.GetKeyDown(m_pandemicKey) || Input.GetButtonDown("Button A"))
                {
                    pandemic.StartPandemic();
                    screenCntrol.ChengePandemicTextColor(255.0f, 255.0f, 0.0f, isClear);
                    pandemicFlag = true;
                }
            }
        }
        // 制限時間を迎えたらゲームオーバー
        if (time == 0.0f)
        {
            GameOver();
        }
        // ウイルスゲージが0になったらゲームオーバー
        if (overFlag.GetOverFlag() == false)
        {
            GameOver();
        }
    }