コード例 #1
0
 public void LoadLevel(int levelId)
 {
     Camera2DFollow.firstSlowPan = true;
     if (ReturnLevelNumber() > 1)
     {
         musicManager.ChangeMusicOnExitMenus(levelId);
     }
     FadeOutAndLoad(levelId);
 }
コード例 #2
0
    void Start()
    {
        musicManager = FindObjectOfType <MusicManager>();
        levelTitle   = FindObjectOfType <LevelTitle>();
        if (GameObject.FindObjectOfType <PlayerController>() != null)
        {
            playerBody = GameObject.FindObjectOfType <PlayerController>().GetComponent <Rigidbody2D>();
        }
        cursor       = FindObjectOfType <CustomCursor>();
        playerGun    = FindObjectOfType <Gun>();
        levelCurtain = FindObjectOfType <Fade>();
        if (levelCurtain == null)
        {
            InstantiateCurtain();
        }
                #if UNITY_WEBGL
        if (PlayerPrefsManager.ReturnMaxLevel() < 1)
        {
            PlayerPrefsManager.UnlockMaxLevel(1);
        }
                #endif
                #if UNITY_STANDALONE
        if (ReturnLevelNumber() == 1 && SaveManager.localMaxLevel < 1)
        {
            SaveManager.localMaxLevel = 1;
        }
        SaveManager.SaveGame();
                #endif

        if (SceneManager.GetActiveScene().buildIndex <= 3)
        {
            SetCustomCursor(false);
        }
        if (SceneManager.GetActiveScene().name == "03aWin")
        {
            musicManager.ChangeMusicOnExitMenus(34);
            Cursor.visible = false;
        }
        if (SceneManager.GetActiveScene().name == "00Splash")
        {
            Cursor.visible = false;
            if (autoLoadNextLevelAfter <= 0)
            {
                Debug.Log("Auto load disabled, use a positive number to enable");
            }
            else
            {
                Invoke("LoadNextLevel", autoLoadNextLevelAfter);
            }
        }
    }