// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Alpha1) == true && targetOneFadedOut && loadScene == null) { currentTarget = 1; loadScene = SceneManager.LoadSceneAsync(2); loadScene.allowSceneActivation = false; } if (Input.GetKeyDown(KeyCode.Alpha2) == true && targetTwoFadedOut && loadScene == null) { currentTarget = 2; loadScene = SceneManager.LoadSceneAsync(2); loadScene.allowSceneActivation = false; } if (loadScene != null) { if (loadScene.progress >= 0.9f && targetOneFadedOut && targetTwoFadedOut) { switch (currentTarget) { case 1: targetOne.SetActive(true); targetOneImage.CrossFadeAlpha(1.0f, 1.0f, true); targetOneFadedOut = false; guiArrows.SetDesiredDirection(targetTwo.transform); //set initial direction to target two to get user to look at target one guiArrows.Show(); break; case 2: targetTwo.SetActive(true); targetTwoImage.CrossFadeAlpha(1.0f, 1.0f, true); targetTwoFadedOut = false; guiArrows.SetDesiredDirection(targetOne.transform); //set initial direction to target one to get user to look at target one guiArrows.Show(); break; default: Debug.Log("No target selected"); break; } } if (loadScene.progress >= 0.9f && Input.GetKeyDown(KeyCode.Alpha5)) { loadScene.allowSceneActivation = true; } Debug.Log("progress: " + loadScene.progress); } }
// Update is called once per frame void Update() { switch (SceneManager.GetActiveScene().buildIndex) { case 0: //Start break; case 1: //Lobby if (targetOneFadedOut && targetTwoFadedOut && conditions.Count > 0) { if (runNumber > 1 && !onBreak) { targetOne.SetActive(true); targetOneImage.CrossFadeAlpha(1.0f, 1.0f, true); targetOneFadedOut = false; guiArrows.SetDesiredDirection(targetTwo.transform); //set initial direction to target two to get user to look at target one guiArrows.Show(); } else if (!onBreak) { if (runNumber % 2 == 0) { targetTwo.SetActive(true); targetTwoImage.CrossFadeAlpha(1.0f, 1.0f, true); targetTwoFadedOut = false; guiArrows.SetDesiredDirection(targetOne.transform); //set initial direction to target one to get user to look at target one guiArrows.Show(); } else { targetOne.SetActive(true); targetOneImage.CrossFadeAlpha(1.0f, 1.0f, true); targetOneFadedOut = false; guiArrows.SetDesiredDirection(targetTwo.transform); //set initial direction to target two to get user to look at target one guiArrows.Show(); } } } else if (conditions.Count == 0) { finishedInstructions.SetActive(true); } break; case 2: //City if (timer < trafficLightChangeDelay && controller != null) { controller.toggle(trafficLightYellowInterval, vehicleClearanceInterval); trafficLightChangeDelay = -999f; } if (timer > 0) { timer = timer - Time.deltaTime; } break; default: break; } if (Input.GetButtonDown("Cancel")) { Application.Quit(); } }