Beispiel #1
0
 public void Load(LevelName level)
 {
     if (!SceneManager.GetSceneByName(level.ToString()).isLoaded)
     {
         SceneManager.LoadScene(level.ToString(), LoadSceneMode.Additive);
         PlayerHUDManager.Instance.ChangeLevel(level);
     }
 }
    public void LoadLevel(LevelName levelName, int spawnIndex)
    {
        curSpawnIndex = spawnIndex;

        // Load level
        SceneManager.LoadScene(levelName.ToString());
    }
    IEnumerator loadLevel(string levelText)
    {
        LevelName levelToLoad = (LevelName)scenePassThroughDataRef.levelNum;

        if (levelToLoad == LevelName.EndScene)
        {
            DialogueBox.gameObject.SetActive(false);
            LastLevelDialogueBox.gameObject.SetActive(true);
            LastLevelMessage.text = levelText;
        }
        else
        {
            DialogueBox.gameObject.SetActive(true);
            LastLevelDialogueBox.gameObject.SetActive(false);
            Message.text = levelText;
        }

        imageToFade.gameObject.SetActive(true);

        yield return(new WaitForSeconds(5));

        if (PlayerExists == true)
        {
            playerControllerRef.playerDead();
        }
        PlayerExists = false;
        SceneManager.LoadScene(levelToLoad.ToString());
    }
Beispiel #4
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player" && IsActived == false)
     {
         IsActived = true;
         SceneManager.LoadScene(NextLevel.ToString(), LoadSceneMode.Single);
     }
 }
 public void LoadLevel(LevelName levelName)
 {
     Debug.Log(levelName.ToString() + " Loaded");
     Utility.isGameOver = false;
     TrunkRotator.Instance.RemoveBonueses();
     GameManager.Instance.currentLevelName = levelName;
     GameManager.Instance.UpdateLevelInfo(levels[levelName]);
     KnifeStack.Instance.LoadKnives();
     TrunkRotator.Instance.UpdateRotation();
     UIManager.Instance.UpdateLevelName(levelName);
     PlayerPrefManager.Instance.HighScore = levelName;
 }
Beispiel #6
0
 public void SetLastNestUsed()
 {
     GameManager.instance.gameFile.saveArea = levelName.ToString();
     GameManager.instance.gameFile.saveNest = levelPosition.ToString();
 }
Beispiel #7
0
 public void LoadScene(LevelName levelName)
 {
     SceneManager.LoadScene(levelName.ToString(), LoadSceneMode.Single);
 }
Beispiel #8
0
    public void OpenLevel <T>(LevelName levelName) where T : LevelBase
    {
        if (m_LevelNow != null)
        {
            CloseLevel();
        }
        GameObject Level = Mgr_AssetBundle.Instance.LoadAsset <GameObject>(ABTypes.prefab, levelName.ToString());

        m_LevelNow = Instantiate(Level).GetComponent <T>() as LevelBase;
        m_LevelNow.transform.SetParent(GameManager.Instance.m_MainGame.m_Level, false);
        m_LevelNow.Init();
        m_LevelNow.OnOpen();
    }
Beispiel #9
0
 public void OnValidate()
 {
     sceneName = levelName.ToString();
 }
Beispiel #10
0
 /// <summary>
 /// Saves high score.
 /// </summary>
 /// <param name="levelName">Name of the level.</param>
 /// <param name="time">Name of game mode.</param>
 /// <param name="score">Score amount.</param>
 public static void SaveHighScore(LevelName levelName, TimePeriod time, int score)
 {
     PlayerPrefs.SetInt(string.Concat(levelName.ToString(), time.ToString()), score);
 }
Beispiel #11
0
 /// <summary>
 /// Gets high scores.
 /// </summary>
 /// <param name="levelName">Name of the level.</param>
 /// <param name="time">Name of game mode.</param>
 /// <returns></returns>
 public static int GetHighScore(LevelName levelName, TimePeriod time)
 {
     return(PlayerPrefs.GetInt(string.Concat(levelName.ToString(), time.ToString()), 0));
 }
Beispiel #12
0
 public void RestartLevel()
 {
     GameEventManager.Instance.UnsubscribeObserversToEvent();
     SceneManager.LoadScene(currentLevelName.ToString(), LoadSceneMode.Single);
 }