// Start is called before the first frame update void Start() { animator = this.GetComponent <GameAnimator>(); animator.EnableAllClickables(false); ResetGame(); //nextScreenButton.SetActive(false); //Screen.SetResolution(600, 800, false); }
// Update is called once per frame void Update() { if (isRunning) { switch (matchStage) { case MatchStages.Begin: { float timeElapsed = Time.time - timeStamp; if (timeElapsed > 1) { matchStage = MatchStages.FlashingMode; timeStamp = subTimeStamp = Time.time; } } break; case MatchStages.FlashingMode: { if (Time.time - timeStamp > 1) { matchStage = MatchStages.Hidden; timeStamp = subTimeStamp = Time.time; ShowTheChoicesAboveTheBoxes(false); // should be a transition state animator.EnableAllClickables(); } else { int subTime = (int)((Time.time - subTimeStamp) * 10.0f); bool isOn = (subTime % 2 != 0) ? true : false; ShowTheChoicesAboveTheBoxes(isOn); } } break; case MatchStages.Hidden: { if (animator.GetChoicesMade().Count == 3) { timeStamp = Time.time; matchStage = MatchStages.FinishAndCompare; animator.EnableAllClickables(false); } } break; case MatchStages.FinishAndCompare: { if (Time.time - timeStamp > animator.timeToWaitForFruitAnim / 2) { //ga.EnableAllClickables(false); if (DoChoicesMatch() == true) { animator.PlaySuccessAnimation(); matchStage = MatchStages.NavigateToNextScene; timeStamp = subTimeStamp = Time.time; } else { animator.PlayFailureAnimation(); CleanupAndReset(); //animator.EnableAllClickables(); isRunning = true; matchStage = MatchStages.Begin; timeStamp = subTimeStamp = Time.time; } } } break; case MatchStages.NavigateToNextScene: { if (Time.time - timeStamp > animator.timeToWaitForFruitAnim) { nextScreenButton.SetActive(true); } } break; } //timeStamp } }