Example #1
0
    IEnumerator LoadUI()
    {
        AsyncOperation loadUI = SceneManager.LoadSceneAsync("UI", LoadSceneMode.Additive);

        while (!loadUI.isDone)
        {
            yield return(null);
        }
        string tempJob = "";

        switch (numOfSelectedCharacter)
        {
        case 0:
            tempJob = "Warrior";
            break;

        case 1:
            tempJob = "Archer";
            break;

        case 2:
            tempJob = "Magician";
            break;
        }
        GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
        foreach (GameObject player in players)
        {
            if (!Equals(player.name, tempJob))
            {
                player.tag = "Untagged";
                player.SetActive(false);
            }
        }
        GameObject[] icons = GameObject.FindGameObjectsWithTag("PlayerIcon");
        foreach (GameObject icon in icons)
        {
            if (!Equals(icon.name, tempJob))
            {
                icon.tag = "Untagged";
                icon.SetActive(false);
            }
        }
        GameManager.SetPlayer();
        GameObject        mainCamera        = GameObject.FindGameObjectWithTag("MainCamera");
        ThirdPersonCamera thirdPersonCamera = mainCamera.GetComponent <ThirdPersonCamera>();

        thirdPersonCamera.SetCamPos();
        Minimap miniMapCamera = GameObject.Find("MiniMapCamera").GetComponent <Minimap>();

        miniMapCamera.Init();
        SceneManager.GetSceneByName("UI").GetRootGameObjects()[0].transform.Find("Skill").GetComponent <UIController>().InitSkillUI();
        //StaticVarAndFunction.UnloadNewCharacter();
        SaveLoadManager slm = GameObject.FindWithTag("Setting").GetComponent <SaveLoadManager>();

        slm.Init();
        slm.gameObject.SetActive(false);
        GameManager.isLoading = false;
        Destroy(this.gameObject);
    }