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")); }
public void LoadGameVariables(bool loadGlobals = true) { GlobalControls.MapData = mapInfos; if (loadGlobals) { LuaScriptBinder.Clear(); } foreach (string key in playerVariablesNum.Keys) { if (loadGlobals || key.Contains("PlayerPos")) { double a; playerVariablesNum.TryGetValue(key, out a); LuaScriptBinder.Set(null, key, DynValue.NewNumber(a)); } } if (loadGlobals) { foreach (string key in playerVariablesStr.Keys) { string a; playerVariablesStr.TryGetValue(key, out a); LuaScriptBinder.Set(null, key, DynValue.NewString(a)); } foreach (string key in playerVariablesBool.Keys) { bool a; playerVariablesBool.TryGetValue(key, out a); LuaScriptBinder.Set(null, key, DynValue.NewBoolean(a)); } } Inventory.inventory.Clear(); foreach (string str in inventory) { Inventory.inventory.Add(new UnderItem(str)); } PlayerCharacter.instance = player; ControlPanel.instance = controlpanel; MusicManager.hiddenDictionary = soundDictionary; string mapName; if (UnitaleUtil.MapCorrespondanceList.ContainsValue(lastScene)) { mapName = UnitaleUtil.MapCorrespondanceList.FirstOrDefault(x => x.Value == lastScene).Key; } else { mapName = lastScene; } GlobalControls.lastScene = mapName; LuaScriptBinder.Set(null, "PlayerMap", DynValue.NewString(mapName)); CYFAnimator.specialPlayerHeader = playerHeader; }
public static void Reset() { Initialized = false; LuaScriptBinder.Clear(); PlayerCharacter.Reset(); }