// == onclick Events == public void Start_OnClick() { SceneManager.LoadSceneAsync(SceneNames.GAME_LEVEL); }
//Play button is pressed. Start the game. public void StartGame() { PlayerPrefs.SetFloat("gametime", 0); SceneManager.LoadSceneAsync("Level1", LoadSceneMode.Single); //Application.LoadLevel(1); }
public void SceneName(string name) { PlayerPrefs.SetString("sceneName", name); SceneManager.LoadSceneAsync(loadSceneName); }
private void onSoloPlayButtonDown() { SceneManager.LoadSceneAsync("IngameScene"); }
public void PlayGame() { //Application.LoadLevel (playGameLevel); SceneManager.LoadSceneAsync(playGameLevel); }
private void OnStartClick(EventContext context) { SceneManager.LoadSceneAsync(SceneName.MAP); }
public void Back() { SceneManager.LoadSceneAsync(1); }
private IEnumerator LoadMainScene(SceneIndex scene, SceneModel model) { OnLoadingStart?.Invoke(); IsLoading = true; // Make sure to clean up the current active scene before destroying it if (_activeScene != null) { _activeScene.Controller.BeforeDestroy(); } // Start the scene loading asyncronous operation AsyncOperation loadSceneJob = SceneManager.LoadSceneAsync(scene.ToString()); while (!loadSceneJob.isDone) { yield return(null); // Callback to update based on the async task progress OnLoadingUpdate?.Invoke(loadSceneJob.progress); } _loadedScenes.Clear(); GC.Collect(); Scene loadedScene = SceneManager.GetSceneByName(scene.ToString()); if (loadedScene.isLoaded) { bool controllerFound = false; // Get the scene object to initialize the scene using the ISceneController interface GameObject[] rootObjects = loadedScene.GetRootGameObjects(); foreach (GameObject rootObject in rootObjects) { // Try to get the scene controller so we can initialize the scene ISceneController sceneController = rootObject.GetComponent <ISceneController>(); // This object didn't have the scene controller if (sceneController == null) { continue; } // Create a loaded scene handle LoadedScene managedLoadedScene = new LoadedScene(sceneController, model, rootObject, scene); _loadedScenes.Add(managedLoadedScene); _activeScene = managedLoadedScene; sceneController.BaseModel = model; yield return(sceneController.Initialization()); sceneController.AfterInitialization(); controllerFound = true; } if (!controllerFound) { Debug.LogError("[SceneTransitionManager] Could not find any object with component SceneController in scene: " + loadedScene.name); } } yield return(new WaitForSeconds(1)); OnLoadingFinished?.Invoke(); IsLoading = false; }
private void LoadNextScene() { var scene = _scenesToLoad.Shift(); SceneManager.LoadSceneAsync(scene, LoadSceneMode.Additive).completed += OnSceneLoadedOrUnloaded; }
public void jugar() { SceneManager.LoadSceneAsync(1); }
public void showNextScene(string scene) { SceneManager.LoadSceneAsync(scene, LoadSceneMode.Single); }
private void LoadSceneAsynchronously(string sceneName) { SceneManager.LoadSceneAsync(sceneName); }
public void Options_OnClick() { SceneManager.LoadSceneAsync(SceneNames.OPTIONS_MENU, LoadSceneMode.Additive); }
public void GoToMainMenu() { SceneManager.LoadSceneAsync(SceneNames.MAIN_MENU); }
// 유틸 : 씬 로드 ( Change 방식 : GoTo 명령시 호출됨 ) AsyncOperation LoadScene(eSceneType eType, Action <bool> pComplate) { return(SetLoadPostProcess(pComplate, SceneManager.LoadSceneAsync(eType.ToString(), LoadSceneMode.Single))); }
//changes current scene to the same scene with the name of the param t_nameOfScene public void ChangeScreen(string t_nameOfScene) { SceneManager.LoadSceneAsync(t_nameOfScene); }
// 유틸 : 씬 로드 ( Add 방식 : SceneData 클래스에서 호출됨 ) AsyncOperation AddScene(string strSceneName, Action <bool> pComplate) { return(SetLoadPostProcess(pComplate, SceneManager.LoadSceneAsync(strSceneName, LoadSceneMode.Additive))); }
// Start is called before the first frame update void Start() { instance = this; SceneManager.LoadSceneAsync((int)SceneIndex.StartMenu, LoadSceneMode.Additive); }
IEnumerator LoadAsyncOperation() { AsyncOperation gamelvl = SceneManager.LoadSceneAsync(5); yield return(new WaitForEndOfFrame()); }
private void ReloadScene() { SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().name); InitiateGame(); }
public void OpenSettings() { gm.isPaused = true; SceneManager.LoadSceneAsync(settingsSceneNumber, LoadSceneMode.Additive); }
private void ToMainMenu() { SceneManager.LoadSceneAsync(0); InitiateGame(); }
private void onMultiPlayButtonDown() { SceneManager.LoadSceneAsync("MatchingScene"); }
public IEnumerator loadChosingHero() { yield return(SceneManager.LoadSceneAsync(ScenesName.ChoseHero, LoadSceneMode.Additive)); SceneManager.GetSceneByName("ChoseHero").GetRootGameObjects()[0].GetComponent <ChoseHeroPage>().returnEvent = myEvent; }
// Update is called once per frame //May need to mess with player prefs actually. //As in, store a string pair, so that we know whether or not Player1 is using keyboard, or if we need to shift down void Update() { if (gameCont.player1_in == null) { if (Input.GetButtonDown("A_P1")) { gameCont.player1_in = new PlayerInput("P1"); isController = true; gameCont.num_players += 1; } if (Input.GetButtonDown("A_P1_KEYBOARD")) { gameCont.player1_in = new PlayerInput("P1_KEYBOARD"); isKeyboard = true; gameCont.num_players += 1; } } if (isKeyboard) { if (gameCont.player2_in == null) { if (Input.GetButtonDown("A_P1")) { gameCont.player2_in = new PlayerInput("P1"); gameCont.num_players += 1; } } if (gameCont.player3_in == null) { if (Input.GetButtonDown("A_P2")) { gameCont.player3_in = new PlayerInput("P2"); gameCont.num_players += 1; } } if (gameCont.player4_in == null) { if (Input.GetButtonDown("A_P3")) { gameCont.player4_in = new PlayerInput("P3"); gameCont.num_players += 1; } } } else if (isController) { if (gameCont.player2_in == null) { if (Input.GetButtonDown("A_P2")) { gameCont.player2_in = new PlayerInput("P2"); gameCont.num_players += 1; } } if (gameCont.player3_in == null) { if (Input.GetButtonDown("A_P3")) { gameCont.player3_in = new PlayerInput("P3"); gameCont.num_players += 1; } } if (gameCont.player4_in == null) { if (Input.GetButtonDown("A_P4")) { gameCont.player4_in = new PlayerInput("P4"); gameCont.num_players += 1; } } } if (gameCont.player1_in != null && !activated_p1) { player1.GetComponent <SelectPlayerControls> ().iC = gameCont.player1_in; player1.GetComponent <SelectPlayerControls> ().txt_Name = GameObject.Find("Player1Name").GetComponent <Text>(); player1.GetComponent <SelectPlayerControls> ().active = true; playerActivate(player1_Col); eventSystem_p1.GetComponent <NewEventSystem> ().player = player1; eventSystem_p1.GetComponent <NewEventSystem>().selection = GameObject.Find("Player1Color").GetComponent <ColorPickerScript> ().redSlider.gameObject; activated_p1 = true; } if (gameCont.player2_in != null && !activated_p2) { player2.GetComponent <SelectPlayerControls> ().iC = gameCont.player2_in; player2.GetComponent <SelectPlayerControls> ().txt_Name = GameObject.Find("Player2Name").GetComponent <Text>(); player2.GetComponent <SelectPlayerControls> ().active = true; playerActivate(player2_Col); eventSystem_p2.GetComponent <NewEventSystem> ().player = player2; eventSystem_p2.GetComponent <NewEventSystem>().selection = GameObject.Find("Player2Color").GetComponent <ColorPickerScript> ().redSlider.gameObject; activated_p2 = true; } if (gameCont.player3_in != null && !activated_p3) { player3.GetComponent <SelectPlayerControls> ().iC = gameCont.player3_in; player3.GetComponent <SelectPlayerControls> ().txt_Name = GameObject.Find("Player3Name").GetComponent <Text>(); player3.GetComponent <SelectPlayerControls> ().active = true; playerActivate(player3_Col); eventSystem_p3.GetComponent <NewEventSystem> ().player = player3; eventSystem_p3.GetComponent <NewEventSystem>().selection = GameObject.Find("Player3Color").GetComponent <ColorPickerScript> ().redSlider.gameObject; activated_p3 = true; } if (gameCont.player4_in != null && !activated_p4) { player4.GetComponent <SelectPlayerControls> ().iC = gameCont.player4_in; player4.GetComponent <SelectPlayerControls> ().txt_Name = GameObject.Find("Player4Name").GetComponent <Text>(); player4.GetComponent <SelectPlayerControls> ().active = true; playerActivate(player4_Col); eventSystem_p4.GetComponent <NewEventSystem> ().player = player4; eventSystem_p4.GetComponent <NewEventSystem>().selection = GameObject.Find("Player4Color").GetComponent <ColorPickerScript> ().redSlider.gameObject; activated_p4 = true; } if (gameCont.num_players == 1) { if (player1.GetComponent <SelectPlayerControls> ().ready) { moveOn = true; } } if (gameCont.num_players == 2) { if (player1.GetComponent <SelectPlayerControls> ().ready&& player2.GetComponent <SelectPlayerControls> ().ready) { moveOn = true; } } if (gameCont.num_players == 3) { if (player1.GetComponent <SelectPlayerControls> ().ready&& player2.GetComponent <SelectPlayerControls> ().ready&& player3.GetComponent <SelectPlayerControls> ().ready) { moveOn = true; } } if (gameCont.num_players == 4) { if (player1.GetComponent <SelectPlayerControls> ().ready&& player2.GetComponent <SelectPlayerControls> ().ready&& player3.GetComponent <SelectPlayerControls> ().ready&& player4.GetComponent <SelectPlayerControls> ().ready) { moveOn = true; } } if (moveOn) { if (activated_p1) { player1.GetComponent <SelectPlayerControls> ().cntDown = true; } if (activated_p2) { player2.GetComponent <SelectPlayerControls> ().cntDown = true; } if (activated_p3) { player3.GetComponent <SelectPlayerControls> ().cntDown = true; } if (activated_p4) { player4.GetComponent <SelectPlayerControls> ().cntDown = true; } StartCoroutine(nameInput(10)); } if (loadNew) { if (activated_p1) { var color = "#" + player1_Sliders.GetComponent <ColorPickerScript>().red.ToString("X2") + player1_Sliders.GetComponent <ColorPickerScript>().green.ToString("X2") + player1_Sliders.GetComponent <ColorPickerScript>().blue.ToString("X2"); PlayerPrefs.SetString("player1_color", color); PlayerPrefs.SetString("player1_name", player1.GetComponent <SelectPlayerControls>().name); } if (activated_p2) { var color = "#" + player2_Sliders.GetComponent <ColorPickerScript>().red.ToString("X2") + player2_Sliders.GetComponent <ColorPickerScript>().green.ToString("X2") + player2_Sliders.GetComponent <ColorPickerScript>().blue.ToString("X2"); PlayerPrefs.SetString("player2_color", color); PlayerPrefs.SetString("player2_name", player2.GetComponent <SelectPlayerControls>().name); } if (activated_p3) { var color = "#" + player3_Sliders.GetComponent <ColorPickerScript>().red.ToString("X2") + player3_Sliders.GetComponent <ColorPickerScript>().green.ToString("X2") + player3_Sliders.GetComponent <ColorPickerScript>().blue.ToString("X2"); PlayerPrefs.SetString("player3_color", color); PlayerPrefs.SetString("player3_name", player3.GetComponent <SelectPlayerControls>().name); } if (activated_p4) { var color = "#" + player4_Sliders.GetComponent <ColorPickerScript>().red.ToString("X2") + player4_Sliders.GetComponent <ColorPickerScript>().green.ToString("X2") + player4_Sliders.GetComponent <ColorPickerScript>().blue.ToString("X2"); PlayerPrefs.SetString("player4_color", color); PlayerPrefs.SetString("player4_name", player4.GetComponent <SelectPlayerControls>().name); } PlayerPrefs.SetInt("NumPlayers", gameCont.num_players); PlayerPrefs.Save(); gameCont.players = new PlayerInput[gameCont.num_players + 1]; if (gameCont.num_players >= 1) { gameCont.players[1] = gameCont.player1_in; } if (gameCont.num_players >= 2) { gameCont.players[2] = gameCont.player2_in; } if (gameCont.num_players >= 3) { gameCont.players[3] = gameCont.player3_in; } if (gameCont.num_players >= 4) { gameCont.players[4] = gameCont.player4_in; } if (transition_happens_only_once) { //should happen after timer goes off for player names SceneManager.LoadSceneAsync(next_scene); transition_happens_only_once = false; } } }
public void PlayGame() { sound.Stop(); sound.Play(); SceneManager.LoadSceneAsync("Level1", mode: LoadSceneMode.Single); }
//Leaderboard button is pressed. public void LeaderBoardButtonInMenuPressed() { optionMenu.enabled = false; PlayerPrefs.SetFloat("gametime", 0); SceneManager.LoadSceneAsync("End", LoadSceneMode.Single); }
IEnumerator TransitToAsync(string destination) { yield return(SceneManager.LoadSceneAsync(Scenes.Transit, LoadSceneMode.Single)); yield return(SceneManager.LoadSceneAsync(destination, LoadSceneMode.Single)); }
void Start() { StartCoroutine("LoadAnim"); SceneManager.LoadSceneAsync(PlayerPrefs.GetString("Scene to Load")); }
public void EndGame() { SceneManager.LoadSceneAsync("Menu"); }