private void LoadLevel()
        {
            string levelName = _levelNameInput.text;
            Level  level     = LevelSaveLoader.LoadLevel(levelName);

            _levelEditorAssistant.InstantiateLevel(level);
        }
    public void LevelSelectButton()
    {
        LevelPanel.SetActive(true);
        MainPanel.SetActive(false);
        EventSystem es = EventSystem.current;

        es.SetSelectedGameObject(null);
        es.SetSelectedGameObject(Back_Button);
        levelsBeat = LevelSaveLoader.LoadLevelsBeat();
        if (levelsBeat >= 2)
        {
            level2Button.SetActive(true);
            level3Button.SetActive(true);
        }
        else if (levelsBeat >= 1)
        {
            level2Button.SetActive(true);
            level3Button.SetActive(false);
        }
        else
        {
            level2Button.SetActive(false);
            level3Button.SetActive(false);
        }
    }
        private void SaveLevel()
        {
            string levelName = _levelNameInput.text;
            Level  level     = _levelEditorAssistant.GenerateLevel(levelName);

            LevelSaveLoader.SaveLevel(level);
        }
    public void ResetLevelsBeat()
    {
        int resetnum = 0;

        LevelSaveLoader.SaveLevelBeat(resetnum);
        EventSystem es = EventSystem.current;

        ResetPanel.SetActive(false);
        MainPanel.SetActive(true);
        es.SetSelectedGameObject(null);
        es.SetSelectedGameObject(LevelSelect);
    }
Exemple #5
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))//only end level when player enters the end zone
     {
         int levelsBeat = LevelSaveLoader.LoadLevelsBeat();
         if (levelNum > levelsBeat)
         {
             LevelSaveLoader.SaveLevelBeat(levelNum);
         }
         SceneManager.LoadScene("Main_Menu");
     }
 }
    public void ResetLevelsBeat()
    {
        int resetnum = 0;

        LevelSaveLoader.SaveLevelBeat(resetnum);
        Vector3 reset = new Vector3(0, 1, 0);

        PlayerPositionSaveLoader.SavePlayerPosition(reset);
        EventSystem es = EventSystem.current;

        ResetPanel.SetActive(false);
        MainPanel.SetActive(true);
        es.SetSelectedGameObject(null);
        es.SetSelectedGameObject(LevelSelect);
    }
    public void SaveWithoutQuit()
    {
        PlayerPositionSaveLoader.SavePlayerPosition(transform.position);
        string levelname  = SceneManager.GetActiveScene().name;
        int    levelsbeat = 0;

        if (levelname == "Level_1")
        {
            levelsbeat = 0;
        }
        else if (levelname == "Level_2")
        {
            levelsbeat = 1;
        }
        else if (levelname == "Level_3")
        {
            levelsbeat = 2;
        }
        LevelSaveLoader.SaveLevelBeat(levelsbeat);
    }
 public void PlayButton()
 {
     levelsBeat = LevelSaveLoader.LoadLevelsBeat();
     if (levelsBeat == 0)
     {
         SceneManager.LoadScene("Level_1");
     }
     else if (levelsBeat == 1)
     {
         SceneManager.LoadScene("Level_2");
     }
     else if (levelsBeat == 2)
     {
         SceneManager.LoadScene("Level_3");
     }
     else
     {
         SceneManager.LoadScene("Level_3");
     }
 }