public static void PlaySound(string basis, string sound, float volume = 0.65f) { sound = FileLoader.getRelativePathWithoutExtension(sound).Replace('\\', '/'); for (int i = 1; i > 0; i++) { object audio = NewMusicManager.audiolist[basis + i]; if (audio != null) { if (audio.ToString().ToLower() != "null") { if (!NewMusicManager.isStopped(basis + i)) { continue; } } else { NewMusicManager.audiolist.Remove(basis + i); NewMusicManager.CreateChannel(basis + i); } } else { NewMusicManager.CreateChannel(basis + i); } NewMusicManager.SetVolume(basis + i, volume); NewMusicManager.PlaySound(basis + i, sound); break; } }
public void EndGameOver() { if (!GlobalControls.modDev) { SaveLoad.Load(false); } if (!UnitaleUtil.IsOverworld) { UIController.EndBattle(true); Destroy(gameObject); if (GlobalControls.modDev) { SceneManager.LoadScene("ModSelect"); } else { foreach (string str in NewMusicManager.audioname.Keys) { if (str == "StaticKeptAudio") { NewMusicManager.Stop(str); ((AudioSource)NewMusicManager.audiolist[str]).clip = null; ((AudioSource)NewMusicManager.audiolist[str]).time = 0; } } } } else { EndGameOverRevive(); } if (!GlobalControls.modDev) { TPHandler tp = Instantiate(Resources.Load <TPHandler>("Prefabs/TP On-the-fly")); tp.sceneName = LuaScriptBinder.Get(null, "PlayerMap").String; if (UnitaleUtil.MapCorrespondanceList.ContainsValue(tp.sceneName)) { foreach (KeyValuePair <string, string> entry in UnitaleUtil.MapCorrespondanceList) { if (entry.Value == tp.sceneName) { tp.sceneName = entry.Key; break; } } } tp.position = new Vector3((float)LuaScriptBinder.Get(null, "PlayerPosX").Number, (float)LuaScriptBinder.Get(null, "PlayerPosY").Number, LuaScriptBinder.Get(null, "PlayerPosZ") == null ? 0 : (float)LuaScriptBinder.Get(null, "PlayerPosZ").Number); tp.direction = 2; tp.noFadeIn = true; tp.noFadeOut = false; GameObject.DontDestroyOnLoad(tp); tp.LaunchTPInternal(); } }
/// <summary> /// Sends the player back to the title screen, making him lose his progression /// </summary> [CYFEventFunction] public void TitleScreen() { NewMusicManager.DestroyChannel("StaticKeptAudio"); GameObject.Destroy(GameObject.Find("Player")); GameObject.Destroy(GameObject.Find("Canvas OW")); StaticInits.MODFOLDER = "@Title"; StaticInits.Initialized = false; StaticInits.InitAll(); GameObject.Destroy(GameObject.Find("Main Camera OW")); SceneManager.LoadScene("TitleScreen"); }