// Update is called once per frame void Update() { GameObject firstCanvas = GameObject.Find("InitialScreen"); GameObject sceneOrgan = GameObject.Find("SceneOrcastrator"); SceneOrganizer sceneScript = sceneOrgan.GetComponent <SceneOrganizer> (); if (StartButtonPushed == true) { firstCanvas.GetComponent <CanvasGroup> ().alpha -= (Time.deltaTime * AlphaChangeRate); //MyAni.Play ("StartSceneCamAni", -1, 0f); MyAni.SetBool("StartButtonPushed", true); } if (firstCanvas.GetComponent <CanvasGroup> ().alpha <= 0) { firstCanvas.GetComponent <Canvas> ().enabled = false; StartCoroutine(InstructionTime()); } if (NextLevelPush == true) { if (Input.GetKey(KeyCode.Return) || Input.GetButtonDown("XboxAButton") || Input.GetButtonDown("XboxStartButton")) { sceneScript.NextLevel(); } } if (Input.GetButtonDown("XboxAButton") || Input.GetButtonDown("XboxStartButton")) { StartButtonPushed = true; } }
//Called when the player hits the last waypoint, the one named "LevelEnd" IEnumerator EndGame() { GameObject sceneOrgan = GameObject.Find("SceneOrcastrator"); SceneOrganizer sceneScript = sceneOrgan.GetComponent <SceneOrganizer> (); //Wait TimeTillEnd seconds before quitting the game yield return(new WaitForSeconds(TimeTillEnd)); //Application.Quit (); //Instead, call the next level sceneScript.NextLevel(); }