From c6a6815e4eab7b3f23c6a794dd3db8aea9d3e7ab Mon Sep 17 00:00:00 2001 From: kimura Date: Thu, 24 Jun 2021 10:26:19 +0900 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E6=88=90=E5=8A=9F=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- popcorn/Assets/PopcornGameManager.cs | 34 ++++++++++++++++------------ 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/popcorn/Assets/PopcornGameManager.cs b/popcorn/Assets/PopcornGameManager.cs index c162c21b..a8f9b56a 100644 --- a/popcorn/Assets/PopcornGameManager.cs +++ b/popcorn/Assets/PopcornGameManager.cs @@ -17,6 +17,7 @@ public class PopcornGameManager : MonoBehaviour private bool isProgress; private int gameCount; private int failCount; + private bool isPerfect; private readonly int maxGameCount = 3; private readonly int maxFailCount = 2; @@ -44,6 +45,7 @@ public class PopcornGameManager : MonoBehaviour { gameCount = 0; failCount = 0; + isPerfect = true; powerMeter.StartMove(); tapAction = () => { @@ -53,11 +55,8 @@ public class PopcornGameManager : MonoBehaviour var pos = powerMeter.GetCurrentPosisiton(); Debug.Log($"tap! {pos}"); // 判定 - if (!CheckQuality(pos)) - { - failCount++; - } - + CheckQuality(pos); + this.CallWaitForSeconds(1f, () => { powerResultText.text = ""; @@ -84,6 +83,10 @@ public class PopcornGameManager : MonoBehaviour if (gameCount >= maxGameCount) { gameResultText.text = "成功!"; + if (isPerfect) + { + gameResultText.text = "大成功!"; + } powerMeter.gameObject.SetActive(false); tapAction = () => { }; panController.enabled = false; @@ -104,21 +107,24 @@ public class PopcornGameManager : MonoBehaviour }; } - private bool CheckQuality(float pos) + private void CheckQuality(float pos) { - //Great=0.3 //Perfect=0.45~0.5 - powerResultText.text = "ミス!"; + //Good=0.3 + if (pos <= 0.05f) + { + powerResultText.text = "パーフェクト"; + return; + } if (pos <= 0.2) { powerResultText.text = "グッド"; - if (pos <= 0.05f) - { - powerResultText.text = "パーフェクト"; - } - return true; + isPerfect = false; + return; } - return false; + powerResultText.text = "ミス!"; + isPerfect = false; + failCount++; } // Update is called once per frame