public void EndGame() { timeTaken = Time.timeSinceLevelLoad - 3f; audioSource.Play(); SaveUtils.SaveTrial(); Invoke("LoadNextLevel", audioSource.clip.length); }
// Changes the countText and checks for end of game void setCountText() { countText.text = "Score: " + count.ToString(); if (checkEnd()) { end = true; SaveUtils.SaveTrial(); deactivateEnemies(); } }
// this bad boy is called before the timer disables and returns the // player back to the main menu. Adds all the statistice to each list. public void AddHistoryEntry() { difficultyHistory.Add(difficulty); timeLimitHistory.Add(timeLimit); scoreHistory.Add(score); ballNum = CalculateBallNum(); numberOfBallsHistory.Add(ballNum); SaveUtils.SaveTrial(); // when returning to menu the game title displays this oldScore = score; }
void OnTriggerEnter(Collider other) { Debug.Log("Finish!"); mover.velocity = 0; mover.active = false; SaveUtils.SaveTrial(); if (!hasInstantiated) { Instantiate(endCanvas); hasInstantiated = true; } }
public void EndGame() { timeTaken = Time.timeSinceLevelLoad - timerDelay; // Plays end game audio audioSource.Play(); // Saves data to file SaveUtils.SaveTrial(); // Loads next level at the end of the audio clip if (audioSource.clip != null) { Invoke("LoadNextLevel", audioSource.clip.length); } else { LoadNextLevel(); } }
public void EndGame() { audioSource.Play(); SaveUtils.SaveTrial(); Invoke("LoadNextLevel", audioSource.clip.length); }
// Update is called once per frame void Update() { if (startGame) { // Time Manipulation time = Time.time - startTime; int minutes = ((int)time / 60); int seconds = ((int)time % 60); // Handles game timeout if (minutes >= minLimit && seconds >= secLimit) { startGame = false; endLight.SetActive(true); oriLight.SetActive(false); endLight.GetComponent <Animation>().Play(); scoreText.text = "Score: " + points; SaveUtils.SaveTrial(); } // Handles evaluating answers if (answerCount == level) { if (sameArray(answer, sequence)) { Debug.Log(true); correct.Play(); if (points + 1 == level) { points += 1; Debug.Log(points); } updateSequence(true); Invoke("glowCubes", (float)1); } else if (level == 1) { Debug.Log(answerCount + " " + level); Debug.Log(false); wrong.Play(); answerCount = 0; Invoke("glowCubes", (float)1); } else { Debug.Log(false); wrong.Play(); updateSequence(false); Invoke("glowCubes", (float)1); } } // Handles answer inputs if (answerTurn) { if (fbHandler.GetKeysDown(2)) { answer[answerCount] = 0; answerCount += 1; glow(blue, 0.1); Debug.Log(sequence.Length + " - " + answer.Length); } else if (fbHandler.GetKeysDown(1)) { answer[answerCount] = 1; answerCount += 1; glow(red, 0.1); Debug.Log(sequence.Length + " - " + answer.Length); } else if (fbHandler.GetKeysDown(4)) { answer[answerCount] = 2; answerCount += 1; glow(yellow, 0.1); Debug.Log(sequence.Length + " - " + answer.Length); } else if (fbHandler.GetKeysDown(3)) { answer[answerCount] = 3; answerCount += 1; glow(green, 0.1); Debug.Log(sequence.Length + " - " + answer.Length); } } } }