大成功を追加

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 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