private void Awake() { if (instance == null) { instance = GetComponent <CustomSceneManager>(); } }
public void Init() { MainMenuCanvas.enabled = true; MainSettingsMenu.enabled = false; if (SceneManagerGO == null) { SceneManagerGO = GameObject.Find("SceneManager"); } if (SceneManagerGO == null) { Debug.Log("Cant find SceneManagerGO"); } customSceneManager = ExtendedGameObject.SetComponent <CustomSceneManager>(SceneManagerGO); customSceneManager.SetScenesArray(SceneNames); customSceneManager.Init(); Score.text = GetHighScore().ToString(); if (PlayerPrefs.GetInt("SRT_ALOWSOUND", 0) == 0) { SoundStatus.text = "Sound OFF"; } else { SoundStatus.text = "Sound ON"; } didInit = true; }
// Update is called once per frame void Update() { if (transform.eulerAngles.z > stoprad && !stopped) { stopped = true; stop = true; message.enabled = true; } if (transform.eulerAngles.z > endrad && stopped && transform.eulerAngles.z < 300) { stop = true; Debug.Log("end scene"); CustomSceneManager.LoadNext(); } if (!stop) { transform.Rotate(new Vector3(0f, 0f, 150f) * Time.deltaTime); Debug.Log(transform.eulerAngles.z); } if (dragged) { stop = false; message.text = "Well Done!"; } }
// Use this for initialization void Start() { sm = SceneManagerGO.GetComponent <CustomSceneManager>(); rm = SceneManagerGO.GetComponent <ResourceManager>(); rm.FoodResource = StartingFoodResource; rm.HumanResource = StartingHumanResource; }
IEnumerator Start() { yield return(CustomSceneManager.WaitForSceneLoadedOrUnloaded(toLoad)); if (CustomSceneManager.IsSceneUnloaded(toLoad)) { yield return(CustomSceneManager.LoadSceneAsync(toLoad, LoadSceneMode.Additive)); } }
public IEnumerator RequestUnload() { numLoadRequests--; yield return(CustomSceneManager.WaitForSceneLoadedOrUnloaded(sceneToLoad)); if (numLoadRequests < 1 && CustomSceneManager.IsSceneLoaded(sceneToLoad)) { yield return(CustomSceneManager.UnloadSceneAsync(sceneToLoad)); } }
public IEnumerator RequestLoad() { numLoadRequests++; yield return(CustomSceneManager.WaitForSceneLoadedOrUnloaded(sceneToLoad)); if (numLoadRequests > 0 && CustomSceneManager.IsSceneUnloaded(sceneToLoad)) { yield return(CustomSceneManager.LoadSceneAsync(sceneToLoad, LoadSceneMode.Additive)); } }
void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); return; } _instance = this; DontDestroyOnLoad(this.gameObject); }
IEnumerator Start() { yield return(CustomSceneManager.WaitForSceneLoadedOrUnloaded(playerScene)); if (CustomSceneManager.IsSceneUnloaded(playerScene)) { yield return(CustomSceneManager.LoadSceneAsync(playerScene, LoadSceneMode.Additive)); GameObject player = GameObject.FindWithTag("Player"); player.transform.position = transform.position; } }
void Awake() { if (sceneManager == null) { sceneManager = this; DontDestroyOnLoad(gameObject); } else if (sceneManager != this) { Destroy(gameObject); } }
static int _g_get_sceneParams(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); CustomSceneManager gen_to_be_invoked = (CustomSceneManager)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.sceneParams); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(1); }
void Awake() { Screen.SetResolution(Screen.width, (Screen.width / 9) * 16, true); if (m_Instance == null) { m_Instance = GetComponent <CustomSceneManager>(); } else { Destroy(m_Instance); } }
private void Awake() { DontDestroyOnLoad(this); if (instance == null) { instance = this; } else { Object.Destroy(gameObject); } }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { CustomSceneManager gen_ret = new CustomSceneManager(); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to CustomSceneManager constructor!")); }
static int _m_LoadSceneAsync(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); CustomSceneManager gen_to_be_invoked = (CustomSceneManager)translator.FastGetCSObj(L, 1); int gen_param_count = LuaAPI.lua_gettop(L); if (gen_param_count == 3 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING) && translator.Assignable <System.Action <int> >(L, 3)) { string _sceneName = LuaAPI.lua_tostring(L, 2); System.Action <int> _action = translator.GetDelegate <System.Action <int> >(L, 3); gen_to_be_invoked.LoadSceneAsync(_sceneName, _action); return(0); } if (gen_param_count == 2 && (LuaAPI.lua_isnil(L, 2) || LuaAPI.lua_type(L, 2) == LuaTypes.LUA_TSTRING)) { string _sceneName = LuaAPI.lua_tostring(L, 2); gen_to_be_invoked.LoadSceneAsync(_sceneName); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to CustomSceneManager.LoadSceneAsync!")); }
static int _m_LoadScene(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); CustomSceneManager gen_to_be_invoked = (CustomSceneManager)translator.FastGetCSObj(L, 1); { string _sceneName = LuaAPI.lua_tostring(L, 2); gen_to_be_invoked.LoadScene(_sceneName); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
static int _m_SetSceneParams(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); CustomSceneManager gen_to_be_invoked = (CustomSceneManager)translator.FastGetCSObj(L, 1); { object[] _param = translator.GetParams <object>(L, 2); gen_to_be_invoked.SetSceneParams(_param); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
//TODO: Behaviour when player234 finish selection. public void Start() { /* * for (int i = 0; i < canMonsterMove.Length; i++) * { * canMonsterMove[i] = true; //This should be depending on gamestate, but for now it isn't. * } */ if (SceneManager.GetActiveScene().name != "Tutorial") { _canMonsterMove[0] = false; } // Debug.Log("Index to Load: " + runTimeChoises.chosenEnvironments[0].environmentIndex.ToString()); //FindObjectOfType<InputManager>().ToggleInputAllow(true); canPlayerMove = true; gameState = initialGamestate; // GameObject.DontDestroyOnLoad(this); if (sceneManager == null) { sceneManager = FindObjectOfType <CustomSceneManager>(); } //Ensure all cross-scene reference scriptableObjects are initialized properly: if (isGamePaused.myBool) { isGamePaused.setBool(false); } // runTimeChoises.runTimeLoopCount = 1; // this is the first loop NextEnvironment(); }
public void LoadSceneInstance(int i) { CustomSceneManager.LoadScene(i); }
private void ChangeScene() { CustomSceneManager.LoadNext(); }
public void Awake() { instance = this; DontDestroyOnLoad(gameObject); }
public void changeScene() { CustomSceneManager.LoadNext(); }
//Sort use instead of constructor void Awake() { _instance = this; Screen.sleepTimeout = (int)SleepTimeout.NeverSleep; }
private void Awake() { _musicManager = FindObjectOfType <MusicManager>(); choice = 4; // the choice is set back to the default value try { customSceneManager = GameObject.Find("SceneManager").GetComponent <CustomSceneManager>(); } catch { } if (choiceType == "Character") { #region InitializeCharacterSelection ShuffleList(characterpool.characterStats); for (int i = 0; i < characterChoices.Length; i++) { P1Stats characterStats = characterpool.characterStats[i]; characterSprites[i].sprite = characterStats.characterSprite; characterNames[i].text = characterStats.myName; characterChoices[i] = characterStats; } #endregion InitializeCharacterSelection } if (choiceType == "Item") { #region InitializeItemSelection int poolLenght = AllPossiblePlayerItems.Length; poolLenght -= runtimeChoices.runTimeLoopCount; playerItemPool = new PlayerItems[poolLenght]; AvailableItems = new List <PlayerItems>(); foreach (PlayerItems item in AllPossiblePlayerItems) { AvailableItems.Add(item); // add the item to the available items to choose from if (item == runtimeChoices.baselineItem) { AvailableItems.Remove(item); Debug.Log("Removing this item: " + item.itemName); } for (int i = 0; i < AllPossiblePlayerItems.Length; i++) { try { if (item == runtimeChoices.playerItems[i]) { AvailableItems.Remove(item); Debug.Log("Removing this item: " + item.itemName); } } catch { } } } for (int i = 0; i < AvailableItems.Count; i++) { playerItemPool[i] = AvailableItems[i]; } if (runtimeChoices.runTimeLoopCount != 4) { int random = Random.Range(0, playerItemPool.Length); int random2 = random; if (playerItemPool.Length <= 1) { random2 = Random.Range(0, playerItemPool.Length); } while (random2 == random) { Debug.Log("random2 was the same as random, rerolling"); random2 = Random.Range(0, playerItemPool.Length); } playerItemChoices[0] = playerItemPool[random]; playerItemChoices[1] = playerItemPool[random2]; choiceNameText[0].text = playerItemChoices[0].name; choiceNameText[1].text = playerItemChoices[1].name; itemImageTargets[0].sprite = playerItemChoices[0].itemSprite; itemImageTargets[1].sprite = playerItemChoices[1].itemSprite; } else { itemImageTargets[0].gameObject.SetActive(false); itemImageTargets[1].gameObject.SetActive(false); theOnlyButton.SetActive(true); theOnlyButton.GetComponent <Image>().sprite = theGrandPrize; theOnlyButton.GetComponentInChildren <TextMeshProUGUI>().text = "Sweet Victory"; } #endregion InitializeItemSelection } if (choiceType == "Minion") // naming inconsistency between Minion and Enemy { #region InitializeMinionSelection ShuffleList(enemyPool); for (int i = 0; i < enemyModifierChoices.Length; i++) { Enemy enemy = enemyPool[i]; enemySprites[i].sprite = enemy.sprite; enemyNames[i].text = enemy.name; enemyChoices[i] = enemy; } #endregion InitializeMinionSelection } if (choiceType == "Modifier") { #region InitializeModifierSelection ShuffleList(modifierPool); for (int i = 0; i < enemyModifierChoices.Length; i++) { EnemyModifier modifier = modifierPool[i]; modifierSprites[i].sprite = modifier.sprite; modifierNames[i].text = modifier.name; enemyModifierChoices[i] = modifier; } #endregion InitializeModifierSelection } if (choiceType == "Theme") { #region InitializeThemeSelection ShuffleList(environmentThemePool.environmentPool); for (int i = 0; i < environmentThemeChoices.Length; i++) { Environments environmentsTheme = environmentThemePool.environmentPool[i]; themeSprites[i].sprite = environmentsTheme.environments[0].environmentSprite; themeNames[i].text = environmentsTheme.environments[0].environmentName; environmentThemeChoices[i] = environmentsTheme.environments[0]; } #endregion InitializeThemeSelection } }
void Start() { CurrentState = SlotState.AVAILABLE; SceneManager = GameObject.Find("SceneManager").GetComponent <CustomSceneManager>(); }