Exemplo n.º 1
0
    IEnumerator NewGame()
    {
        SpriteRenderer blank = GameObject.Find("Blank").GetComponent <SpriteRenderer>();

        while (blank.color.a <= 1)
        {
            if (tmName.transform.localScale.x < 3)
            {
                tmName.transform.localScale    = new Vector3(tmName.transform.localScale.x + 0.01f, tmName.transform.localScale.y + 0.01f, 1);
                tmName.transform.localPosition = new Vector3(actualX - (((tmName.transform.localScale.x - 1) * diff) / 2),
                                                             actualY - (((tmName.transform.localScale.x - 1) * diff) / 6), tmName.transform.localPosition.z);
            }
            blank.color = new Color(blank.color.r, blank.color.g, blank.color.b, blank.color.a + 0.003f);
            yield return(0);
        }
        while (Camera.main.GetComponent <AudioSource>().isPlaying)
        {
            yield return(0);
        }
        PlayerCharacter.instance.Reset(false);
        LuaScriptBinder.ClearVariables();
        GlobalControls.GameMapData.Clear();
        Inventory.inventory.Clear();
        GameObject.DontDestroyOnLoad(gameObject);
        UnitaleUtil.ResetOW();
        SceneManager.LoadScene("TransitionOverworld");
        yield return(0);

        //yield return Application.isLoadingLevel;
        if (GameObject.Find("Main Camera"))
        {
            GameObject.Destroy(GameObject.Find("Main Camera"));
        }
        GameObject.Destroy(gameObject);
    }
Exemplo n.º 2
0
 public static void ExitOverworld(bool totalUnload = true)
 {
     foreach (string str in NewMusicManager.audiolist.Keys)
     {
         if (((AudioSource)NewMusicManager.audiolist[str]) != null && str != "src")
         {
             GameObject.Destroy(((AudioSource)NewMusicManager.audiolist[str]).gameObject);
         }
     }
     NewMusicManager.audiolist.Clear();
     NewMusicManager.audioname.Clear();
     GameObject.Destroy(GameObject.Find("Player"));
     GameObject.Destroy(GameObject.Find("Canvas OW"));
     GameObject.Destroy(GameObject.Find("Canvas Two"));
     if (GameOverBehavior.gameOverContainerOw)
     {
         GameObject.Destroy(GameOverBehavior.gameOverContainerOw);
     }
     StaticInits.MODFOLDER   = "@Title";
     StaticInits.Initialized = false;
     StaticInits.InitAll();
     UnitaleUtil.ResetOW(true);
     PlayerCharacter.instance.Reset();
     Inventory.inventory.Clear();
     Inventory.RemoveAddedItems();
     ScriptWrapper.instances.Clear();
     GlobalControls.isInFight = false;
     GlobalControls.isInShop  = false;
     LuaScriptBinder.scriptlist.Clear();
     LuaScriptBinder.ClearBattleVar();
     LuaScriptBinder.Clear();
     GameObject.Destroy(GameObject.Find("Main Camera OW"));
 }
Exemplo n.º 3
0
    IEnumerator LoadGame()
    {
        GameObject.DontDestroyOnLoad(gameObject);
        UnitaleUtil.ResetOW();
        SceneManager.LoadScene("TransitionOverworld");
        yield return(0);

        //yield return Application.isLoadingLevel;
        //GameObject.Find("Player").transform.position = new Vector3(;
        StaticInits.MODFOLDER   = LuaScriptBinder.Get(null, "ModFolder").String;
        StaticInits.Initialized = false;
        StaticInits.InitAll();
        if (GameObject.Find("Main Camera"))
        {
            GameObject.Destroy(GameObject.Find("Main Camera"));
        }
        GameObject.Destroy(gameObject);
    }
Exemplo n.º 4
0
    private IEnumerator waitConfirm(bool isForbidden = false)
    {
        yield return(0);

        tmInstr.SetTextQueue(new[] { new TextMessage("[noskipatall]" + (confirmText ?? (GlobalControls.crate ? "LAL GUD???" : "[noskipatall]Is this name correct?")), false, true) });
        tmName.SetEffect(new ShakeEffect(tmName));
        GameObject.Find("Backspace").GetComponent <SpriteRenderer>().enabled = false;
        tmLettersMaj.transform.position = new Vector3(tmLettersMaj.transform.position.x, tmLettersMaj.transform.position.y, 10000);
        tmLettersMin.transform.position = new Vector3(tmLettersMin.transform.position.x, tmLettersMin.transform.position.y, 10000);
        setColor("Quit");
        GameObject.Find("Done").GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, isForbidden ? 0 : 1);
        float diff = calcTotalLength(tmName) * 2;
        float actualX = tmName.transform.localPosition.x, actualY = tmName.transform.localPosition.y;

        while (GlobalControls.input.Confirm != UndertaleInput.ButtonState.PRESSED)
        {
            if (tmName.transform.localScale.x < 3)
            {
                tmName.transform.localScale    = new Vector3(tmName.transform.localScale.x + 0.01f, tmName.transform.localScale.y + 0.01f, 1);
                tmName.transform.localPosition = new Vector3(actualX - (tmName.transform.localScale.x - 1) * diff / 2,
                                                             actualY - (tmName.transform.localScale.x - 1) * diff / 6, tmName.transform.localPosition.z);
            }
            if ((GlobalControls.input.Left == UndertaleInput.ButtonState.PRESSED || GlobalControls.input.Right == UndertaleInput.ButtonState.PRESSED) &&
                GameObject.Find("Done").GetComponent <SpriteRenderer>().enabled&& !isForbidden)
            {
                setColor(choiceLetter == "Quit" ? "Done": "Quit");
                uiAudio.PlayOneShot(AudioClipRegistry.GetSound("menumove"));
            }
            yield return(0);
        }
        uiAudio.PlayOneShot(AudioClipRegistry.GetSound("menuconfirm"));
        if (choiceLetter == "Quit")
        {
            textObjFolder.SetActive(true);
            confirmText = null;
            confirm     = false;
            tmName.transform.localScale = new Vector3(1, 1, 1);
            tmName.SetEffect(null);
            tmName.SetTextQueue(new[] { new TextMessage(playerName, false, true) });
            tmName.transform.localPosition = new Vector3(-calcTotalLength(tmName) / 2, 145, tmName.transform.localPosition.z);
            tmInstr.SetTextQueue(new[] { new TextMessage("[noskipatall]" + (GlobalControls.crate ? "QWIK QWIK QWIK!!!" : "Name the fallen human."), false, true) });
            tmLettersMaj.transform.position = new Vector3(tmLettersMaj.transform.position.x, tmLettersMaj.transform.position.y, 0);
            tmLettersMin.transform.position = new Vector3(tmLettersMin.transform.position.x, tmLettersMin.transform.position.y, 0);
            GameObject.Find("Backspace").GetComponent <SpriteRenderer>().enabled = true;
            setColor("Done");
        }
        else
        {
            PlayerCharacter.instance.Name = playerName;
            if (isNewGame)
            {
                GameObject.Find("Main Camera").GetComponent <AudioSource>().Stop();
                GameObject.Find("Main Camera").GetComponent <AudioSource>().PlayOneShot(AudioClipRegistry.GetSound("intro_holdup"));
                SpriteRenderer blank = GameObject.Find("Blank").GetComponent <SpriteRenderer>();
                while (blank.color.a <= 1)
                {
                    if (tmName.transform.localScale.x < 3)
                    {
                        tmName.transform.localScale    = new Vector3(tmName.transform.localScale.x + 0.01f, tmName.transform.localScale.y + 0.01f, 1);
                        tmName.transform.localPosition = new Vector3(actualX - (tmName.transform.localScale.x - 1f) * diff / 2f, actualY - (tmName.transform.localScale.x - 1f) * diff / 6, tmName.transform.localPosition.z);
                    }
                    blank.color = new Color(blank.color.r, blank.color.g, blank.color.b, blank.color.a + 0.003f);
                    yield return(0);
                }
                while (GameObject.Find("Main Camera").GetComponent <AudioSource>().isPlaying)
                {
                    yield return(0);
                }
                UnitaleUtil.ResetOW();
                SceneManager.LoadScene("TransitionOverworld");
                DiscordControls.StartOW();
            }
            else
            {
                SaveLoad.Save();
                SceneManager.LoadScene("TitleScreen");
            }
        }
    }