Ejemplo n.º 1
0
 private void Start()
 {
     for (int i = 0; i < levelButton.Count; i++)
     {
         int index = i;
         levelButton[i].onClick.AddListener(delegate { levelSelected = levels[index]; SetLevel(); });
     }
 }
Ejemplo n.º 2
0
    private LevelScriptable GetRandomLevel(int finalhardness)
    {
        LevelScriptable levelData = new LevelScriptable
        {
        };

        return(levelData);
    }
Ejemplo n.º 3
0
 //Disable =0   Special>0(needed weather number)  RandomWeather <0(As lower harder)
 private void GenerateLevel(LevelScriptable level)
 {
     hardness = level.hardness;
     GenerateWeather(level.hardness, level.weatherNumber);
     GenerateObjects(level.generationObjectsNumber);
     // print("Actual => " + level.generationObjectsNumber);
     GenerateInGameEvents(level.inGameEventsNumber, level.hardness);
     GenerateInUpgradeMenuEvents(level.hardness, level.inUpgradeMenuEventsNumber);
     GenerateRandomEvents(level.hardness, level.randomEventsNumber);
     SetAllTypes(level.hardness);
 }
Ejemplo n.º 4
0
    /// <summary>
    /// Funzione che avvia il livello successivo se presente
    /// </summary>
    public static void StartNextLevel(LevelManager _currentLevel)
    {
        LevelScriptable currentLevel = instance.lvlsManager.GetSelectedLevel();
        LevelScriptable nextLevel    = instance.lvlsManager.GetNextLevel(currentLevel);

        if (nextLevel != null)
        {
            instance.lvlsManager.SetSelectedLevel(nextLevel);
        }

        instance.gameSM.GoToLevelSetup?.Invoke();
    }
Ejemplo n.º 5
0
    private void Start()
    {
        levelConfig = SelectLevel.Instance.levelSelected;
        playerCollision = gameObject.GetComponent<PlayerCollision>();

        middleLine = Screen.width / 2;

        rb = GetComponent<Rigidbody>();

        _speedAward = levelConfig.speed;
        _speed = levelConfig.speedSide;
        grip = levelConfig.grip;
    }
Ejemplo n.º 6
0
    public LevelScriptable GetNextLevel(LevelScriptable _level)
    {
        LevelScriptable nextLevel = null;

        for (int i = 0; i < levelsOrder.Count; i++)
        {
            if (_level == levelsOrder[i])
            {
                if (i < levelsOrder.Count - 1)
                {
                    nextLevel = levelsOrder[i + 1];
                }
            }
        }

        return(nextLevel);
    }
Ejemplo n.º 7
0
        private void HandleLevelSelected(UI_SelectLevelButton _levelSelected)
        {
            levelSelected = _levelSelected;
            LevelScriptable levelScriptable = _levelSelected.GetLevelScriptable();

            if (levelScriptable.TutorialLevel)
            {
                if (OnLevelSelected != null)
                {
                    OnLevelSelected(levelSelected.GetLevelScriptable(), false);
                }
            }
            else
            {
                EnableAllButtons(false);
                selectingMode = true;
                levelSelected.SelectModePanel(true);
            }
        }
Ejemplo n.º 8
0
    public void ActivationClick()
    {
        LevelScriptable level = LevelLibrary.instance.GetLevel(iteration, iteration % 5 == 0);

        if (level == null)
        {
            level = new LevelScriptable
            {
                name     = "nullName",
                hardness = 0,
                generationObjectsNumber   = 0,
                inGameEventsNumber        = 0,
                weatherNumber             = 0,
                inUpgradeMenuEventsNumber = 0,
                randomEventsNumber        = 0
            };
        }
        //print(level.name);
        GenerateLevel(level);
    }
Ejemplo n.º 9
0
    /// <summary>
    /// Level Scriptable içerisindeki data bilgisi ile sahneyi yükler
    /// </summary>
    /// <param name="level"></param>
    public void LoadLevel(int level)
    {
        LevelScriptable levelScriptable = Resources.Load <LevelScriptable>(Path.Combine("Levels", level.ToString()));

        SceneData[] sceneData = levelScriptable.GetLevelData();
        GameObject  sceneObject;

        foreach (SceneData data in sceneData)
        {
            if (data.objectType == ObjectType.Player)
            {
                sceneObject = GameObject.FindGameObjectWithTag("Player");                 //PlayerController.instance.gameObject;
            }
            else
            {
                GameObject prefab = Resources.Load <GameObject>(Path.Combine("Prefabs", data.objectType.ToString()));
                sceneObject = Instantiate(prefab, transform);
            }

            sceneObject.GetComponent <SceneObject>().SetSceneData(data);
        }
    }
Ejemplo n.º 10
0
 private void HandleLevelSelected(LevelScriptable _selectedLevel, bool _speedRun)
 {
     context.gameManager.GetLevelsManager().SetSelectedLevel(_selectedLevel);
     context.gameManager.GetLevelsManager().SetMode(_speedRun);
     GameManager.StartGame();
 }
Ejemplo n.º 11
0
 private void AssignLevelsRequiredCollectableSize(LevelScriptable newLevel)
 {
     LevelCollectableSize = newLevel.LevelCollectablesCount;
     ZoneCollectable      = newLevel.Zone1CollectableCount;
     ZoneChangeable       = newLevel.ZoneChangeable;
 }
Ejemplo n.º 12
0
 private void InstantiateLevel(LevelScriptable newLevel)
 {
     Instantiate(newLevel.LevelPrefab, Vector3.zero, Quaternion.identity);
     enabled = false;
 }
Ejemplo n.º 13
0
 public void SetSelectedLevel(LevelScriptable _selectedLevel)
 {
     selectedLevel = _selectedLevel;
 }
Ejemplo n.º 14
0
 private void ChangeLowPolyWaterColor(LevelScriptable newLevel)
 {
     lowPolyWater.material.color = newLevel.LowPolyWaterColor;
 }