Example #1
0
    public void LoadSelectedStage()
    {
        if (selectedIndex == -1)
        {
            Debug.Log("please select a stage");
            return;
        }

        var fileContent = File.ReadAllText(stagePaths[selectedIndex]);

        map = StageBuilder.Instance.LoadStageFromJsonInGame(fileContent.ToString());


        player.StartPosition = (map.PlayerSpawns != null || map.PlayerSpawns.Count == 0) ?
                               Vector3.zero + Vector3.up * 3: map.PlayerSpawns[0].transform.position + (Vector3.up);
        map.RepositionToInGame();

        player.ResetPosition();
    }