void Update()
    {
        if (infection.AllInfection() || countor.IsStart == false)
        {
            return;
        }

        if (camRotate.HoleType != type)
        {
            return;
        }

        time += Time.deltaTime;

        int minCycle = 3;

        //ゲームオーバー条件を追加
        //ボムの数が0かつ、一つも感染した穴がなかったら
        if (bombCount.NowBomCount() == 0)
        {
            gameOverTime += Time.deltaTime;
        }
        else
        {
            gameOverTime = 0;
        }

        if (gameOverTime > 10 && infection.IsAllKillVirus())
        {
            createCycle = minCycle;
        }
        else
        {
            createCycle = Mathf.Max(createTime - (bombCount.NowBomCount() * 0.5f), minCycle);
        }

        if (time > createCycle)
        {
            int randomType = Random.Range(0, 2);

            if (randomType == 0)
            {
                random_x = Random.Range(createPos[0].position.x, createPos[1].position.x);
                random_z = Random.Range(createPos[0].position.z, createPos[1].position.z);
            }
            else
            {
                random_x = Random.Range(createPos[2].position.x, createPos[3].position.x);
                random_z = Random.Range(createPos[2].position.z, createPos[3].position.z);
            }

            Vector3 vec = new Vector3(random_x, 0, random_z);

            GameObject enemy = Instantiate(BossAttackEnemy, vec, Quaternion.identity);
            enemy.transform.SetParent(parent, true);
            time = 0;
        }
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        if (holeInf.AllInfection())
        {
            if (isFirst)
            {
                cam.DoShake(1.0f, 0.5f);
                isFirst = false;
            }

            if (boss != null)
            {
                Destroy(boss);
            }
            foreach (Transform t in transform)
            {
                Destroy(t.gameObject);
            }
        }
    }
Exemple #3
0
    void Update()
    {
        //フェードアウト
        if (fade)
        {
            if (image.color.a > 0)
            {
                image.color -= new Color(0, 0, 0, Time.deltaTime * 2);
            }
            else
            {
                fade = false;
            }
        }

        //クリアタイム記録
        if (!IsClear || !IsGameOver)
        {
            //時間経過
            if (IsStart)
            {
                timer += Time.deltaTime;                    //経過時間を計算
            }
            int minuteTime = Mathf.FloorToInt(timer) / 60;  //分を割り出す

            //経過時間を表示
            if (Mathf.FloorToInt(timer) - minuteTime * 60 < 10)
            {
                //秒数が0~9(1桁)の時
                timeText.text = "Time\n" + minuteTime + ":0" + (Mathf.FloorToInt(timer) % 60);
            }
            else
            {
                //秒数が10~59(2桁)の時
                timeText.text = "Time\n" + minuteTime + ":" + (Mathf.FloorToInt(timer) % 60);
            }


            //クリア処理
            if (Hole.enabled && Hole.AllInfection() && IsClear == false)    //クリアテキストがアクティブ
            {
                //clearText.SetActive(true);
                //ステージクリア
                clearTime = Mathf.FloorToInt(timer);    //クリアタイムを秒で記録
                IsClear   = true;

                //ログにクリアタイムを表記
                if (Mathf.FloorToInt(timer) - minuteTime * 60 < 10)
                {
                    //秒数が0~9(1桁)の時
                    Debug.Log("クリアタイム " + clearTime / 60 + ":0" + clearTime % 60);
                }
                else
                {
                    //秒数が10~59(2桁)の時
                    Debug.Log("クリアタイム " + clearTime / 60 + ":" + clearTime % 60);
                }

                //ポーズボタン機能停止
                pose.GameClear();

                //リザルトへ移動
                StartCoroutine(GoResult());
            }

            //ゲームオーバー処理
            if (pumpking.HP <= 0 && IsGameOver == false)
            {
                IsGameOver = true;

                gameOverImg.sprite = gameoverSp;
                gameOverImg.gameObject.SetActive(true);

                //ポーズボタン機能停止
                pose.GameClear();

                //リザルトへ移動
                StartCoroutine(GoGameOver());
            }
        }
    }