大成功を追加

This commit is contained in:
kimura 2021-06-24 10:26:19 +09:00
parent b6dec2d6a3
commit c6a6815e4e
1 changed files with 20 additions and 14 deletions

View File

@ -17,6 +17,7 @@ public class PopcornGameManager : MonoBehaviour
private bool isProgress; private bool isProgress;
private int gameCount; private int gameCount;
private int failCount; private int failCount;
private bool isPerfect;
private readonly int maxGameCount = 3; private readonly int maxGameCount = 3;
private readonly int maxFailCount = 2; private readonly int maxFailCount = 2;
@ -44,6 +45,7 @@ public class PopcornGameManager : MonoBehaviour
{ {
gameCount = 0; gameCount = 0;
failCount = 0; failCount = 0;
isPerfect = true;
powerMeter.StartMove(); powerMeter.StartMove();
tapAction = () => tapAction = () =>
{ {
@ -53,10 +55,7 @@ public class PopcornGameManager : MonoBehaviour
var pos = powerMeter.GetCurrentPosisiton(); var pos = powerMeter.GetCurrentPosisiton();
Debug.Log($"tap! {pos}"); Debug.Log($"tap! {pos}");
// 判定 // 判定
if (!CheckQuality(pos)) CheckQuality(pos);
{
failCount++;
}
this.CallWaitForSeconds(1f, () => this.CallWaitForSeconds(1f, () =>
{ {
@ -84,6 +83,10 @@ public class PopcornGameManager : MonoBehaviour
if (gameCount >= maxGameCount) if (gameCount >= maxGameCount)
{ {
gameResultText.text = "成功!"; gameResultText.text = "成功!";
if (isPerfect)
{
gameResultText.text = "大成功!";
}
powerMeter.gameObject.SetActive(false); powerMeter.gameObject.SetActive(false);
tapAction = () => { }; tapAction = () => { };
panController.enabled = false; 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 //Perfect=0.45~0.5
powerResultText.text = "ミス!"; //Good=0.3
if (pos <= 0.05f)
{
powerResultText.text = "パーフェクト";
return;
}
if (pos <= 0.2) if (pos <= 0.2)
{ {
powerResultText.text = "グッド"; powerResultText.text = "グッド";
if (pos <= 0.05f) isPerfect = false;
{ return;
powerResultText.text = "パーフェクト";
}
return true;
} }
return false; powerResultText.text = "ミス!";
isPerfect = false;
failCount++;
} }
// Update is called once per frame // Update is called once per frame