Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        roadDropdown = gameObject.transform.Find("LoadRoadControls/RoadNameDropdown").GetComponent <Dropdown>();
        // add lane types to dropdown, then set current active
        roadDropdown.ClearOptions();

        List <string> roadFileNames = new List <string>(RoadVizSaveSystem.getFilenames());

        gameObject.transform.Find("LoadRoadControls/LoadButton").GetComponent <Button>().interactable = roadFileNames.Count > 0;

        roadDropdown.AddOptions(new List <string>(RoadVizSaveSystem.getFilenames()));
    }
Esempio n. 2
0
    public void handleLoadDesign()
    {
        Debug.Log("Load design selected");

        string roadNameToLoad = RoadVizSaveSystem.getFilenames()[roadDropdown.value];

        IEnumerator LoadLevel()
        {
            DontDestroyOnLoad(this.transform.gameObject);
            Debug.Log(this);

            AsyncOperation asyncLoadLevel = SceneManager.LoadSceneAsync("DevelopmentEnvironment", LoadSceneMode.Single);

            //while (!asyncLoadLevel.isDone)
            //{
            //  Debug.Log("Async loading scene ongoing...");
            //yield return null;
            //}

            yield return(new WaitWhile(() => !asyncLoadLevel.isDone));

            yield return(new WaitForEndOfFrame());

            Debug.Log("Async loading scene complete!");
            Road rd = GameObject.Find("Road").GetComponent <Road>();

            rd.loadRoad(roadNameToLoad);

            Destroy(this.transform.gameObject);
        }

        StartCoroutine(LoadLevel());



        //SceneManager.LoadScene("DevelopmentEnvironment");
    }