private void Awake()
 {
     if (instance == null)
     {
         instance = GetComponent <CustomSceneManager>();
     }
 }
예제 #2
0
    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;
    }
예제 #3
0
    // 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!";
        }
    }
예제 #4
0
    // 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));
        }
    }
예제 #6
0
    public IEnumerator RequestUnload()
    {
        numLoadRequests--;
        yield return(CustomSceneManager.WaitForSceneLoadedOrUnloaded(sceneToLoad));

        if (numLoadRequests < 1 && CustomSceneManager.IsSceneLoaded(sceneToLoad))
        {
            yield return(CustomSceneManager.UnloadSceneAsync(sceneToLoad));
        }
    }
예제 #7
0
    public IEnumerator RequestLoad()
    {
        numLoadRequests++;
        yield return(CustomSceneManager.WaitForSceneLoadedOrUnloaded(sceneToLoad));

        if (numLoadRequests > 0 && CustomSceneManager.IsSceneUnloaded(sceneToLoad))
        {
            yield return(CustomSceneManager.LoadSceneAsync(sceneToLoad, LoadSceneMode.Additive));
        }
    }
예제 #8
0
    void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(this.gameObject);
            return;
        }

        _instance = this;
        DontDestroyOnLoad(this.gameObject);
    }
예제 #9
0
    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;
        }
    }
예제 #10
0
 void Awake()
 {
     if (sceneManager == null)
     {
         sceneManager = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (sceneManager != this)
     {
         Destroy(gameObject);
     }
 }
예제 #11
0
        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);
        }
예제 #12
0
    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);
        }
    }
예제 #14
0
        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!"));
        }
예제 #15
0
        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!"));
        }
예제 #16
0
        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));
            }
        }
예제 #17
0
        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));
            }
        }
예제 #18
0
    //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);
 }
예제 #20
0
 private void ChangeScene()
 {
     CustomSceneManager.LoadNext();
 }
예제 #21
0
 public void Awake()
 {
     instance = this;
     DontDestroyOnLoad(gameObject);
 }
예제 #22
0
 public void changeScene()
 {
     CustomSceneManager.LoadNext();
 }
예제 #23
0
    //Sort use instead of constructor
    void Awake()
    {
        _instance = this;

        Screen.sleepTimeout = (int)SleepTimeout.NeverSleep;
    }
예제 #24
0
    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
        }
    }
예제 #25
0
 void Start()
 {
     CurrentState = SlotState.AVAILABLE;
     SceneManager = GameObject.Find("SceneManager").GetComponent <CustomSceneManager>();
 }