示例#1
0
    public void LoadMenue()
    {
        if (StartMenueLoading != null)
        {
            StartMenueLoading(this);
        }

        if (_nextLevel != null)
        {
            Destroy(_nextLevel.GetGameObject());
        }

        _nextLevel = _MenueLevel.GetComponent <ILevelChange>();
        _nextLevel.LevelInAnimated += LevelAnimated;

        if (_actualLevel != null)
        {
            UnloadLevel();

            _actualLevel.LevelOutAnimated += (object sender) =>
            {
                _nextLevel.AnimateToLevel();
            }
        }
        else
        {
            _nextLevel.AnimateToLevel();
        }
    }
示例#2
0
    public void LoadNextLevel()
    {
        GameObject level = Instantiate(_LevelsPrefabs[0]);

        level.transform.position = new Vector3(0, _LevelHeight, 0);
        _nextLevel = level.GetComponent <ILevelChange>();
    }
示例#3
0
    private void LevelAnimated(object sender)
    {
        if (_nextLevel.GetGameObject() == _MenueLevel)
        {
            if (MenueLoaded != null)
            {
                MenueLoaded(this);
            }
        }
        else
        {
            if (LevelChanged != null)
            {
                LevelChanged(this);
            }
        }

        _actualLevel = _nextLevel;
        _nextLevel   = null;
    }
示例#4
0
 public void StartNextLevel()
 {
     _actualLevel = _nextLevel;
     _nextLevel   = null;
     LoadNextLevel();
 }