// Use this for initialization void awake() { if (m_GameInstanceData == null) { m_GameInstanceData = new HoldValue(); } }
public static HoldValue GetGrobal() { if (m_GameInstanceData == null) { m_GameInstanceData = new HoldValue(); } return m_GameInstanceData; }
IEnumerator HoldBallCoroutine() { yield return(new WaitForSecondsRealtime(0.5f)); while (HoldValue != 26) { HoldValue += 1; TextAndShadow[0].text = "Power: " + HoldValue.ToString(); TextAndShadow[1].text = "Power: " + HoldValue.ToString(); yield return(new WaitForSecondsRealtime(0.5f)); } TextAndShadow[0].text = "Power: ???"; TextAndShadow[1].text = "Power: ???"; }
IEnumerator Toss() { Checking = true; if (HoldValue != PowerNeeded + 1) { IncorrectAnswer = true; } Audio.PlaySoundAtTransform(SFX[0].name, transform); AbleToHillBall = false; Debug.LogFormat("[Hole in One #{0}] You hit the ball with a power level of {1}", moduleId, HoldValue != 27 ? HoldValue.ToString() : "???"); BallHold.GetComponent <KMSelectable>().AddInteractionPunch(((float)HoldValue / 10f)); BallHold.SetActive(false); yield return(new WaitForSecondsRealtime(3f)); if (IncorrectAnswer) { Debug.LogFormat("[Hole in One #{0}] You did something incorrectly. The module striked and performed a reset.", moduleId); Audio.PlaySoundAtTransform(SFX[3].name, transform); yield return(new WaitForSecondsRealtime(0.75f)); Module.HandleStrike(); HoldValue = 0; TextAndShadow[0].text = "Power: 0"; TextAndShadow[1].text = "Power: 0"; BallHold.SetActive(true); Clicked = false; IncorrectAnswer = false; Start(); Proceed(); } else { Debug.LogFormat("[Hole in One #{0}] You did everything correctly. The module solved.", moduleId); Audio.PlaySoundAtTransform(SFX[2].name, transform); yield return(new WaitForSecondsRealtime(0.75f)); Audio.PlaySoundAtTransform(SFX[1].name, transform); Module.HandlePass(); TextAndShadow[0].text = "Hole In One"; TextAndShadow[1].text = "Hole In One"; } Checking = false; }