void launchLevel(RaycastHit hit) { LevelScript levelChoose = hit.collider.GetComponent <LevelScript>(); if (!UserSave.userP.getState(levelChoose.levelIndex - 1) && levelChoose.levelIndex > 0 && !UserSave.userP.getDebug()) { return; } player.clip = buttonClic; player.Play(); fade.fadeOut(); hit.collider.GetComponent <Animator>().SetTrigger("levelSelect"); sceneToLoad = hit.collider.GetComponent <LevelScript>().levelName; }
// Update is called once per frame void Update() { // New scene loading if (sceneToLoad != "none" && player.time > 1.3f) { UnityEngine.SceneManagement.SceneManager.LoadScene(sceneToLoad); } if (Input.GetKeyDown("escape")) { player.clip = buttonClic; player.pitch = 1.2f; player.Play(); fade.fadeOut(); sceneToLoad = "LevelSelect"; } if ((model1 && model1.win) || (model2 && model2.win)) { if (firstWin == false) { player.PlayOneShot(winSound, 0.2f); firstWin = true; } } else if ((model1 && !model1.win) || (model2 && !model2.win)) { firstWin = false; } if (model1.win && winSoundTrig == false) { if (!model2 || model2 && model2.win) { if (UserSave.userP.getDebug() == false) { UserSave.userP.setState(model1.currentLevel, 1); if (model2) { UserSave.userP.setState(model2.currentLevel, 1); } } cameraAnim.SetTrigger("cameraShift"); victoryPanel.SetTrigger("SlideIn"); winSoundTrig = true; player.clip = winSound; player.Play(); } } }
public void onClickButton(string buttonInfo) { soundPlayer.volume = 0.5f; soundPlayer.clip = buttonClic; soundPlayer.Play(); fade.fadeOut(); if (buttonInfo == "classic" || buttonInfo == "test") { UserSave.userP.setDebug(0); if (buttonInfo == "test") { UserSave.userP.setDebug(1); } sceneToLoad = "LevelSelect"; } else if (buttonInfo == "quitLevel") { sceneToLoad = "LevelSelect"; } else { sceneToLoad = buttonInfo; } }