예제 #1
0
    private void Awake()
    {
        _character.Initialize(this);
        _hud.Initialize(this, _character.OnTapDown);
        // level init
        LevelData levelEntry = GameController.Instance.GetSelectedLevelData();

        _timeBonusPosition = levelEntry.TimeBonusCellPosition;
        _spikesPosition    = levelEntry.SpikesPosition;
        _levelData         = new GameLevelData
        {
            Name     = levelEntry.Name,
            MaxCoins = 0
        };
        _levelData.MaxCoins = GameController.Instance.DataLoader.GetLevelMaxCoins(levelEntry.Name);
        Debug.Log("Level " + _levelData.Name + " max coins: " + _levelData.MaxCoins.ToString());

        var levelObj = GameObject.Instantiate(levelEntry.GamePrefab, _tilemapGrid.transform);

        levelObj.transform.localPosition = _levelLocalPosition;
        InitializeTilemap();
        CurrentLevelTime = _levelTotalTime;
        TogglePause(false);
        LevelStarted = false;
    }
    public void InitializeScene()
    {
        _character.Initialize(this);
        _character.transform.position = _characterInitialPosition;
        _hud.Initialize(this, _character.OnSwipe, _character.OnLeftDown, _character.OnRightDown, _character.OnButtonUp);
        // level init
        LevelData levelEntry = GameController.Instance.GetSelectedLevelData();

        _levelData = GameController.Instance.DataLoader.GetLevelMaxData(levelEntry.Name);
        Debug.Log("Level " + _levelData.Name + " max height: " + _levelData.MaxHeight.ToString());
        _config = levelEntry.SceneConfig;
        _cameraPivotPosition.position = new Vector3(0.0f, 0.0f, -5.0f);
        _baseCameraPivotPos           = _cameraPivotPosition.position;
        InitializeLevel();
        CurrentHeight    = 0;
        CurrentPlatforms = 0;
        TogglePause(false);
        LevelStarted = false;
    }
예제 #3
0
 private void Awake()
 {
     _hud.Initialize(this);
     _character.Initialize(_hud.GetJoystick());
     _enemyManager.Initialize(this);
 }