// Jimmy Vegas Unity Tutorials // These scripts are for crashing and resetting using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public class CrashMech : MonoBehaviour { public GameObject thePlayer; public GameObject backMusic; public GameObject splashBackground; public GameObject finalScore; void OnTriggerEnter(Collider other) { if(other.tag == "PlayerObject") { this.gameObject.GetComponent().enabled = false; backMusic.SetActive(false); thePlayer.GetComponent().enabled = false; finalScore.GetComponent().text = "FINAL SCORE: " + ScoreCubeMonitor.scoreNum; finalScore.SetActive(true); splashBackground.SetActive(true); splashBackground.GetComponent().Play("SplashFadeIn"); StartCoroutine(ResetGame()); } } IEnumerator ResetGame() { yield return new WaitForSeconds(5); SceneManager.LoadScene(1); } } using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class CubeAvoidReset : MonoBehaviour { void Start() { SceneManager.LoadScene(0); } }