Exemplo n.º 1
0
 private void GenerateCheckpointsWithData(LevelDataClass levelData)
 {
     for (int i = 0; i < levelData.checkpoints.Length; i++)
     {
         GenerateClone(levelData.checkpoints[i], checkpointPrefab);
     }
 }
Exemplo n.º 2
0
 private void GenerateGoalsWithData(LevelDataClass levelData)
 {
     for (int i = 0; i < levelData.goals.Length; i++)
     {
         GenerateClone(levelData.goals[i], goalPrefab);
     }
 }
Exemplo n.º 3
0
 private void GenerateObstaclesWithData(LevelDataClass levelData)
 {
     for (int i = 0; i < levelData.obstacles.Length; i++)
     {
         GameObject obstacleInstance = FindObstacleInstance(levelData.obstacles[i]);
         GenerateClone(levelData.obstacles[i], obstacleInstance);
     }
 }
Exemplo n.º 4
0
    public void LoadLevelObstacles(string levelFileName)
    {
        Debug.Log("Loading Level");
        LevelDataClass loadedData = GetLevelData(levelFileName);

        if (loadedData != null)
        {
            GenerateObstaclesWithData(loadedData);
            GenerateSpawnPlatformWithData(loadedData);
            GenerateCheckpointsWithData(loadedData);
            GenerateGoalsWithData(loadedData);
        }
    }
Exemplo n.º 5
0
    private LevelDataClass GetLevelData(string levelFileName)
    {
        string levelFilePath = Path.Combine(EditLevelList.levelsFolderPath, levelFileName + ".json");

        if (File.Exists(levelFilePath))
        {
            string obstacleDataAsJson = File.ReadAllText(levelFilePath);
            Debug.Log(obstacleDataAsJson);
            LevelDataClass loadedData = JsonUtility.FromJson <LevelDataClass>(obstacleDataAsJson);
            return(loadedData);
        }
        Debug.Log("No Previous Level Data");
        return(null);
    }
Exemplo n.º 6
0
    private void GenerateSpawnPlatformWithData(LevelDataClass levelData)
    {
        GameObject spawnPlatform = GenerateClone(levelData.spawnPlatform, spawnPlatformPrefab);

        GameController.gameController.SetSpawnLocation(spawnPlatform.transform.position);
    }