Exemple #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         // Load the level with no splash delay, a 3 second fade delay, the side wipe fade out transition, use the loading bar & use async direct mode.
         // Async Direct Mode will just trigger the level transition and enable the scene as we have already loaded it with the trigger script.
         LevelTransitionController.LoadLevel(sceneToLoad, 0, 3, LevelTransitionController.TransitionsOut.SideWipe, true, true);
     }
 }
    void Start()
    {
        // Get reference to input controller
        _gci = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerInput>();
        // Get reference to independent control
        _gcic = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>();
        // Get reference to level transition controller
        _levelTransitionController = GetComponent<LevelTransitionController>();

        if (_data == null) {
            _nextScene = new Scene();
            Debug.LogWarning("Next Scene not setted, using Menu by default, please, assign an scene");
            _nextScene.name = "Menu";

        } else {
            string nameScene = SceneManager.GetActiveScene().name;
            _nextScene = _data.GetNextScene(nameScene, out _nextLevel);
            _actualLevel = _data.GetInfoScene(nameScene);

            if (_nextScene==null) {
                _nextScene = _data.GetDefaultScene();
                _nextScene.name = "Thanks";
            }
        }
    }