public override void Update(Task caller) { base.Update(caller); GameObject go = GameObject.Find("SongPlayer"); if (go != null) { DaggerfallSongPlayer player = go.GetComponent <DaggerfallSongPlayer>(); if (player != null) { player.Play(songFile); } } SetComplete(); }
void Update() { if (!streamingWorld.IsInit && titleScreen) { titleScreen.ShowTitle = false; } // Random location // Must have playerEnterExit reference if (Input.GetKeyDown(KeyCode.R)) { StartCoroutine(TeleportRandomLocation()); } // Preset locations if (Input.GetKeyDown(KeyCode.Alpha1)) { StartCoroutine(TeleportLocation("Daggerfall", "Daggerfall")); } if (Input.GetKeyDown(KeyCode.Alpha2)) { StartCoroutine(TeleportLocation("Wayrest", "Wayrest")); } if (Input.GetKeyDown(KeyCode.Alpha3)) { StartCoroutine(TeleportLocation("Sentinel", "Sentinel")); } if (Input.GetKeyDown(KeyCode.Alpha4)) { StartCoroutine(TeleportLocation("Orsinium Area", "Orsinium")); } // Time scale if (Input.GetKeyDown(KeyCode.Equals)) { timeScaleControl += timeScaleStep; if (timeScaleControl > maxTimeScaleControl) { timeScaleControl = maxTimeScaleControl; } dfUnity.WorldTime.TimeScale = timeScaleControl * timeScaleMultiplier; } if (Input.GetKeyDown(KeyCode.Minus)) { timeScaleControl -= timeScaleStep; if (timeScaleControl < minTimeScaleControl) { timeScaleControl = minTimeScaleControl; } dfUnity.WorldTime.TimeScale = timeScaleControl * timeScaleMultiplier; } // Music control if (Input.GetKeyDown(KeyCode.P)) { if (!songPlayer) { return; } SongFilesGM songFile = (SongFilesGM)songIndex; if (!songPlayer.IsPlaying) { songPlayer.Play(songFile.ToString()); } } if (Input.GetKeyDown(KeyCode.RightBracket)) { if (!songPlayer) { return; } int lastSongIndex = songIndex; songIndex++; if (songIndex > maxSongIndex) { songIndex = maxSongIndex; } SongFilesGM songFile = (SongFilesGM)songIndex; if (songIndex != lastSongIndex) { songPlayer.Play(songFile.ToString()); } } if (Input.GetKeyDown(KeyCode.LeftBracket)) { if (!songPlayer) { return; } int lastSongIndex = songIndex; songIndex--; if (songIndex < minSongIndex) { songIndex = minSongIndex; } SongFilesGM songFile = (SongFilesGM)songIndex; if (songIndex != lastSongIndex) { songPlayer.Play(songFile.ToString()); } } }
void PlayCurrentSong() { songPlayer.Song = currentSong; songPlayer.Play(); }