public void UnlockPhoneCorrect() { switch (guess) { case 0: Unlock1.SetActive(true); guess++; correct++; return; case 1: Unlock2.SetActive(true); guess++; correct++; return; case 2: Unlock3.SetActive(true); guess++; correct++; if (correct == 3) { StartCoroutine(CorrectFade()); } else { StartCoroutine(ScreenShake()); } return; } }
public void UnlockPhoneClick(int number) { switch (guess) { case 0: Unlock1.SetActive(true); break; case 1: Unlock2.SetActive(true); break; case 2: Unlock3.SetActive(true); break; } guess++; if (_inputNumber.Count < 3) { _inputNumber.Add(number); } if (_inputNumber.Count == 3) { var currentCode = new Vector3((int)_inputNumber[0], (int)_inputNumber[1], (int)_inputNumber[2]); if (currentCode == _correctCode) { StartCoroutine(CorrectFade()); } else if (currentCode == _jumpCode) { Services.pageState.ChangeGameState("Menu_Main"); } else { StartCoroutine(ScreenShake()); } guess = 0; _inputNumber.Clear(); } }
IEnumerator ScreenShake() { yield return(new WaitForSeconds(1)); //make the screenshake and a vibration play _shakeDuration = 2.0f; #if UNITY_IOS Handheld.Vibrate(); #endif //set all unlocks back to false Unlock1.SetActive(false); Unlock2.SetActive(false); Unlock3.SetActive(false); //make the hint display instructions.SetActive(false); hint.SetActive(true); guess = 0; correct = 0; }
public void UnlockPhoneIncorrect() { Debug.Log("wrong guess"); switch (guess) { case 0: Unlock1.SetActive(true); guess++; return; case 1: Unlock2.SetActive(true); guess++; return; case 2: Unlock3.SetActive(true); guess++; //coroutine a screenshake and reset the guess numbers and unlocks to empty StartCoroutine(ScreenShake()); return; } }