void Update() { if (Input.GetKeyDown(KeyCode.Q)) { //This leaves the puzzle "unsolved" (and no longer "inProgress" for now). Later on, there will be alternate states for: padStat = padStatus.unsolved; } else if (Input.GetKeyDown(KeyCode.R)) { //"solved", meaning the player succeeded in solving the puzzle within the allotted number of attempts padStat = padStatus.solved; } else if (Input.GetKeyDown(KeyCode.F)) { //"failed", meaning the player failed to solve the puzzle within the allotted number of attempts padStat = padStatus.failed; } if (padStat == padStatus.choosing) { } else if (padStat == padStatus.solved) { Solved(); } else if (padStat == padStatus.failed) { Failed(); } else if (padStat == padStatus.unsolved) { Unsolved(); } }
public void ClickButton() { clickedButton = EventSystem.current.currentSelectedGameObject; if (clickedButton != null) { clickedButtonText = clickedButton.GetComponent <Button> ().GetComponentInChildren <Text> (); if (clickedButtonText.text == correctGuess) { clickedButtonText.text = "<color=green>" + clickedButtonText.text + "</color>"; padStat = padStatus.solved; } else { Debug.Log("You guessed wrong"); attemptsLeft--; if (attemptsLeft <= 0) { padStat = padStatus.failed; } else { CompareDigits(); } } } }
void OnEnable() { padStat = padStatus.choosing; padCam.enabled = true; mainCam.enabled = false; buttonParent.SetActive(true); SetNumbers(); AssignGuessesToButtons(false); attemptsLeft = 4; }