//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// /// <summary> /// フィニッシュステートにいく /// </summary> /// <returns></returns> public void setFinish() { anserTime = 0.0f; questionStatus = false; switchIdle = false; switchQuestion = false; KMHH_CharaAnimationManager.ChangeCharaStateToFinish(); //キャラのステート変えるやつ 待機 }
//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// /// <summary> /// エモーションステートにいく /// </summary> /// <returns>成否で分岐</returns> public static void setEmotion(bool anserResult) { questionStatus = false; switchIdle = false; switchQuestion = false; KMHH_CharaAnimationManager.ChangeCharaStateToEmotion(anserResult); //キャラのステート変えるやつ 待機 }
//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// /// <summary> /// 待機にいく /// </summary> /// <returns></returns> public static void setIdle() { anserTime = 0.0f; questionStatus = false; switchIdle = true; switchQuestion = false; Debug.Log("あいどるすてーと選びにいこかな"); KMHH_CharaAnimationManager.ChangeCharaStateToIdle(); //キャラのステート変えるやつ 待機 }
//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// /// <summary> /// クエスチョンステートにいく /// </summary> /// <returns></returns> public void setQuestion() { idleTime = 0.0f; questionStatus = true; switchIdle = false; switchQuestion = true; Debug.Log("すてーと選びにいこかな" + questionStatus); KMHH_CharaAnimationManager.ChangeCharaState(); //キャラのステート変えるやつ questionNumOfTimes = questionNumOfTimes + 1; //出題回数増やす }
//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// /// <summary> /// ゲームの時間進行いろいろ。カウントダウンもやっちゃう /// </summary> /// <returns></returns> // Update is called once per frame public void Update() { debugGameTimeText.text = "でばっぐ情報" + "\n" + "ゲーム経過時間:" + gameTimePast.ToString("f2") + "\n" + "出題回数:" + questionNumOfTimes + "\n" + "出題状態:" + questionStatus + "\n" + "-----------------------\n" + "出題時間のスパン" + kmhhQuestionSpan + "\n" + "出題スイッチ:" + switchQuestion + "\n" + "回答時間" + anserTime.ToString("f2") + "\n" + "-----------------------\n" + "アイドルのスパン" + kmhhIdleSpan + "\n" + "待機スイッチ:" + switchIdle + "\n" + "待機時間" + idleTime.ToString("f2") + "\n"; /////////////////////////////////////////////////////////////////// if ((switchStartMethod == true) && (gameFinish == false)) { getDeltaTime = 0.0f; switchStartMethod = false; Time.timeScale = 1.0f; questionNumOfTimes = 0; countDownEffObj_3 = GameObject.Find("eff_KMHH_CountDown_3"); countDownEffObj_2 = GameObject.Find("eff_KMHH_CountDown_2"); countDownEffObj_1 = GameObject.Find("eff_KMHH_CountDown_1"); countDownEffObj_0 = GameObject.Find("eff_KMHH_CountDown_Start"); countDownEffObj_Fin = GameObject.Find("eff_KMHH_CountDown_Finish"); GameSceneChangeWallObj = GameObject.Find("eff_GameSceneChangeWall"); upDateGameTimerObj = GameObject.Find("ui_GameTimer"); //ゲーム時間経過用オブジェクト拾ってくるぜ upDateGameTimerText.text = gameSetTime.ToString(); // 時間制限をテキスト更新 debugGameTimerObj = GameObject.Find("Debug_CountTimer"); debugGameTimeText = debugGameTimerObj.GetComponentInChildren <Text>(); //kmhh_CAM_Obj = GameObject.Find("KMHH_CharaAnimationManager_Obj"); //KMHH_CharaAnimationManager kmhh_CAM = new KMHH_CharaAnimationManager(); } getDeltaTime += Time.deltaTime; //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //カウントダウン中 if ((gameStart == false) && (gameFinish == false)) { if (getDeltaTime < 0.1f) { gameParamReset(); if (KMHH_CharaAnimationManager.KMHH_CharaAnimator.GetBool("goToIdle") == true) { setIdle(); KMHH_CharaAnimationManager.hideBodyParts(); KMHH_CharaAnimationManager.ChangeQuestionBodyParts(); KMHH_CharaAnimationManager.KMHH_CharaAnimator.SetBool("goToIdle", false); } countDownEffObj_3.SetActive(false); countDownEffObj_2.SetActive(false); countDownEffObj_1.SetActive(false); countDownEffObj_0.SetActive(false); countDownEffObj_Fin.SetActive(false); GameSceneChangeWallObj.SetActive(false); } if ((getDeltaTime >= gameStandbyTime) && (getDeltaTime < gameStandbyTime + 1.0f)) { if (countDownTrigger3 == false) { if (getDeltaTime != gameTimePast) { countDownTrigger3 = true; Debug.Log("3"); countDownEffObj_3.SetActive(true); } } } if ((getDeltaTime >= gameStandbyTime + 1.0f) && (getDeltaTime < gameStandbyTime + 2.0f)) { if (countDownTrigger2 == false) { if (getDeltaTime != gameTimePast) { countDownTrigger2 = true; Debug.Log("2"); countDownEffObj_3.SetActive(false); countDownEffObj_2.SetActive(true); } } } if ((getDeltaTime >= gameStandbyTime + 2.0f) && (getDeltaTime < gameStandbyTime + 3.0f)) { if (countDownTrigger1 == false) { if (getDeltaTime != gameTimePast) { countDownTrigger1 = true; Debug.Log("1"); countDownEffObj_2.SetActive(false); countDownEffObj_1.SetActive(true); } } } if (getDeltaTime >= gameStandbyTime + 3.0f) { gameStart = true; //ゲーム開始状態にする Debug.Log("げーむすたーと"); gameTimePast = 0; questionNumOfTimes = 0; switchQuestion = true; countDownEffObj_1.SetActive(false); countDownEffObj_0.SetActive(true); Invoke("CountDownObjHide", 1.5f); // カウントダウン全部消す setQuestion(); Time.timeScale = editTimeScale; } gameTimePast = getDeltaTime; //経過時間として現在の時間を上書く } //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //ゲーム開始。ゲームが終わってないとき,ゲーム中の時間を記録 if ((gameStart == true) && (gameFinish == false)) { gameCurrentTime += Time.deltaTime; //ゲーム時間を更新 gameTimePast = gameCurrentTime; //経過時間として現在の時間を上書く gameTimePastInt = (int)gameTimePast; //↑整数化 upDateGameTimerText.text = (((gameSetTime - gameTimePastInt).ToString()).PadLeft(2, '0')); //時間文字列更新 //////////////////////////////////////////////////////////////////// //待機スイッチ入ってたら待機の秒数計測 if (switchIdle) { idleTime += Time.deltaTime; } //回答スイッチ入ってたら回答の秒数計測 if (switchQuestion) { anserTime += Time.deltaTime; } //////////////////////////////////////////////////////////////////// //↓制限時間を過ぎたらゲーム開始をfalse,ゲーム終了をtrue if (gameTimePast > gameSetTime) { Debug.Log("しゅうりょう"); questionStatus = false; gameFinishTime = gameTimePast; //ゲーム終了時の時間を記録 GameFinish(); return; } if (idleTime > kmhhIdleSpan) { Debug.Log("待機スパンすぎた"); setQuestion(); } if (anserTime > kmhhQuestionSpan) { Debug.Log("回答スパンすぎた"); if (questionStatus) { setTimeOver(); } //setIdle(); } } //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //ゲームが終わったとき,終了の処理 if ((gameStart == false) && (gameFinish == true)) { countDownEffObj_Fin.SetActive(true); } } //Update()ここまで