// Update is called once per frame void Update() { //intro music if (SceneManager.GetActiveScene().name == "BossLevel") { begin = GameObject.Find("StartAudio").GetComponent <AudioReference>(); } else if (!audio.isPlaying && SceneManager.GetActiveScene().name == "StoryScene") { StoryPlay(); } if (!audio.isPlaying && !begin.UIAudioStart) { if (SceneManager.GetActiveScene().name == "BossLevel") { audio.clip = introBoss; audio.loop = false; audio.Play(); begin.UIAudioStart = true; } } else if (!audio.isPlaying && SceneManager.GetActiveScene().name == "BossLevel" && begin.UIAudioStart == true) { BossMusic(); } }
public void Init() { this.Stations = new List <AudioReference>(); this.StationsById = new Dictionary <uint, AudioReference>(); this.Modes = new List <AudioReference>(); var stationsRegEx = new Regex(@"music\\stations\\.*\.mp3"); foreach (var file in ContentManager.AllFiles) { if (stationsRegEx.IsMatch(file)) { var reference = new AudioReference { Type = AudioType.RADIO_STATION, FilePath = ContentManager.GetPath(file) }; Stations.Add(reference); var idString = Path.GetFileNameWithoutExtension(file); idString = idString.Substring(idString.LastIndexOf("_") + 1); var id = Convert.ToUInt32(idString, 16); reference.ID = id; StationsById.Add(id, reference); } } var tsoAudio = new DBPF(ContentManager.GetPath("TSOAudio.dat")); }
private AudioItem checkSourcesForItemOnce(AudioReference reference, AudioLoadResultHandler resultHandler, bool[] reported) { foreach (AudioSourceManager sourceManager in sourceManagers) { AudioItem item = sourceManager.loadItem(this, reference); if (item != null) { if (item is AudioTrack) { log.debug("Loaded a track with identifier {} using {}.", reference.identifier, sourceManager.GetType().Name); reported[0] = true; resultHandler.trackLoaded((AudioTrack)item); } else if (item is AudioPlaylist) { log.debug("Loaded a playlist with identifier {} using {}.", reference.identifier, sourceManager.GetType().Name); reported[0] = true; resultHandler.playlistLoaded((AudioPlaylist)item); } return(item); } } return(null); }
public IEnumerator ClearMonsterSpawnCells(int fightId) { MonsterSpawnCellDefinition monsterSpawnCellDefinition = m_bossFightMapResources.monsterSpawnCellDefinition; if (null == monsterSpawnCellDefinition) { yield break; } FightMapDefinition definition = m_definition; FightMapRegionDefinition obj = definition.regions[fightId]; Vector2Int sizeMin = obj.sizeMin; Vector2Int sizeMax = obj.sizeMax; List <int> indicesToRemove = ListPool <int> .Get(); foreach (KeyValuePair <int, GameObject> item in m_monsterSpawnCellDictionary) { int key = item.Key; Vector2Int cellCoords = definition.GetCellCoords(key); if (cellCoords.get_x() >= sizeMin.get_x() && cellCoords.get_y() >= sizeMin.get_y() && cellCoords.get_x() < sizeMax.get_x() && cellCoords.get_y() < sizeMax.get_y()) { Transform transform = item.Value.get_transform(); if (AudioManager.isReady) { AudioReference disappearanceSound = monsterSpawnCellDefinition.disappearanceSound; if (disappearanceSound.get_isValid()) { AudioManager.PlayOneShot(disappearanceSound, transform); } } VisualEffect disappearanceEffect = monsterSpawnCellDefinition.disappearanceEffect; if (null != disappearanceEffect) { Object.Instantiate <VisualEffect>(disappearanceEffect, transform.get_position(), transform.get_rotation(), transform.get_parent()); } indicesToRemove.Add(key); } } int indicesToRemoveCount = indicesToRemove.Count; if (indicesToRemoveCount > 0) { float disappearanceDelay = monsterSpawnCellDefinition.disappearanceDelay; if (disappearanceDelay > 0f) { yield return((object)new WaitForTime(disappearanceDelay)); } for (int i = 0; i < indicesToRemoveCount; i++) { int key2 = indicesToRemove[i]; if (m_monsterSpawnCellDictionary.TryGetValue(key2, out GameObject value)) { monsterSpawnCellDefinition.DestroyInstance(value); } } } ListPool <int> .Release(indicesToRemove); }
/// <summary> /// Initializes the audio manager. /// </summary> public void Init() { this.Stations = new List <AudioReference>(); this.StationsById = new Dictionary <uint, AudioReference>(); this.Modes = new List <AudioReference>(); var stationsRegEx = new Regex(@"music/stations/.*\.mp3"); foreach (var file in ContentManager.AllFiles) { if (stationsRegEx.IsMatch(file)) { var reference = new AudioReference { Type = AudioType.RADIO_STATION, FilePath = ContentManager.GetPath(file) }; Stations.Add(reference); var idString = Path.GetFileNameWithoutExtension(file); idString = idString.Substring(idString.LastIndexOf("_") + 1); var id = Convert.ToUInt32(idString, 16); reference.ID = id; StationsById.Add(id, reference); } } TSOAudio = new DBPFFile(ContentManager.GetPath("TSOAudio.dat")); tsov2 = new DBPFFile(ContentManager.GetPath("tsov2.dat")); Stings = new DBPFFile(ContentManager.GetPath("Stings.dat")); EP5Samps = new DBPFFile(ContentManager.GetPath("EP5Samps.dat")); EP2 = new DBPFFile(ContentManager.GetPath("EP2.dat")); Hitlists = new DBPFFile(ContentManager.GetPath("HitListsTemp.dat")); SFXCache = new Dictionary <uint, SoundEffect>(); TracksById = new Dictionary <uint, Track>(); TracksByBackupId = new Dictionary <uint, Track>(); HitlistsById = new Dictionary <uint, Hitlist>(); AddTracksFrom(TSOAudio); //load events _Events = new Dictionary <string, HITEventRegistration>(); var content = ContentManager; var newmain = LoadHitGroup(content.GetPath("sounddata/newmain.hit"), content.GetPath("sounddata/eventlist.txt"), content.GetPath("sounddata/newmain.hsm")); var relationships = LoadHitGroup(content.GetPath("sounddata/relationships.hit"), content.GetPath("sounddata/relationships.evt"), content.GetPath("sounddata/relationships.hsm")); var tsoep5 = LoadHitGroup(content.GetPath("sounddata/tsoep5.hit"), content.GetPath("sounddata/tsoep5.evt"), content.GetPath("sounddata/tsoep5.hsm")); var tsoV2 = LoadHitGroup(content.GetPath("sounddata/tsov2.hit"), content.GetPath("sounddata/tsov2.evt"), null); //tsov2 has no hsm file var tsov3 = LoadHitGroup(content.GetPath("sounddata/tsov3.hit"), content.GetPath("sounddata/tsov3.evt"), content.GetPath("sounddata/tsov3.hsm")); var turkey = LoadHitGroup(content.GetPath("sounddata/turkey.hit"), content.GetPath("sounddata/turkey.evt"), content.GetPath("sounddata/turkey.hsm")); RegisterEvents(newmain); RegisterEvents(relationships); RegisterEvents(tsoep5); RegisterEvents(tsoV2); RegisterEvents(tsov3); RegisterEvents(turkey); }
public unsafe IEnumerator AddMonsterSpawnCell(int x, int y, Direction direction) { MonsterSpawnCellDefinition monsterSpawnCellDefinition = m_bossFightMapResources.monsterSpawnCellDefinition; if (null == monsterSpawnCellDefinition) { yield break; } IMapDefinition mapDefinition = m_mapDefinition; Vector2 val = Vector2Int.op_Implicit(mapDefinition.sizeMin); if ((float)x < ((IntPtr)(void *)val).x || (float)y < ((IntPtr)(void *)val).y) { yield break; } Vector2 val2 = Vector2Int.op_Implicit(mapDefinition.sizeMax); if ((float)x >= ((IntPtr)(void *)val2).x || (float)y >= ((IntPtr)(void *)val2).y) { yield break; } int index = mapDefinition.GetCellIndex(x, y); CellObject cellObject = m_cellObjectsByIndex[index]; Transform transform = cellObject.get_transform(); Vector3 position = transform.get_position() + 0.5f * Vector3.get_up(); Quaternion rotation = Quaternion.get_identity(); if (AudioManager.isReady) { AudioReference appearanceSound = monsterSpawnCellDefinition.appearanceSound; if (appearanceSound.get_isValid()) { AudioManager.PlayOneShot(appearanceSound, transform); } } VisualEffect appearanceEffect = monsterSpawnCellDefinition.appearanceEffect; if (null != appearanceEffect) { Object.Instantiate <VisualEffect>(appearanceEffect, position, rotation, transform); float appearanceDelay = monsterSpawnCellDefinition.appearanceDelay; if (appearanceDelay > 0f) { yield return((object)new WaitForTime(appearanceDelay)); } } GameObject val3 = monsterSpawnCellDefinition.Instantiate(position, rotation, cellObject.get_transform()); if (!(null == val3)) { val3.GetComponent <SpawnCellObject>().SetDirection(direction); m_monsterSpawnCellDictionary.Add(index, val3); } }
private bool checkSourcesForItem(AudioReference reference, AudioLoadResultHandler resultHandler, bool[] reported) { AudioReference currentReference = reference; for (int redirects = 0; redirects < MAXIMUM_LOAD_REDIRECTS && currentReference.identifier != null; redirects++) { AudioItem item = checkSourcesForItemOnce(currentReference, resultHandler, reported); if (item == null) { return(false); } else if (!(item is AudioReference)) { return(true); } currentReference = (AudioReference)item; } return(false); }
// Update is called once per frame void Update() { if (SceneManager.GetActiveScene().name == "LoseScene") { begin = GameObject.Find("StartAudio").GetComponent <AudioReference>(); } else if (SceneManager.GetActiveScene().name == "WinScene") { begin = GameObject.Find("StartAudio").GetComponent <AudioReference>(); } if (!audio.isPlaying && !begin.UIAudioStart) { if (SceneManager.GetActiveScene().name == "LoseScene") { Debug.Log("You died"); //played = true; audio.clip = loseSFX; audio.loop = false; audio.Play(); begin.UIAudioStart = true; } else if (SceneManager.GetActiveScene().name == "WinScene") { audio.clip = winSFX; audio.loop = false; audio.Play(); begin.UIAudioStart = true; } } /* * else if (begin.UIAudioStart && (SceneManager.GetActiveScene().name != "LoseScene")); * { * //audio.Stop(); * begin.UIAudioStart = false; * } */ }
public IEnumerator RemoveMonsterSpawnCell(int x, int y) { MonsterSpawnCellDefinition monsterSpawnCellDefinition = m_bossFightMapResources.monsterSpawnCellDefinition; if (null == monsterSpawnCellDefinition) { yield break; } int cellIndex = m_mapDefinition.GetCellIndex(x, y); if (!m_monsterSpawnCellDictionary.TryGetValue(cellIndex, out GameObject instance)) { yield break; } m_monsterSpawnCellDictionary.Remove(cellIndex); Transform transform = instance.get_transform(); if (AudioManager.isReady) { AudioReference disappearanceSound = monsterSpawnCellDefinition.disappearanceSound; if (disappearanceSound.get_isValid()) { AudioManager.PlayOneShot(disappearanceSound, transform); } } VisualEffect disappearanceEffect = monsterSpawnCellDefinition.disappearanceEffect; if (null != disappearanceEffect) { Object.Instantiate <VisualEffect>(disappearanceEffect, transform.get_position(), transform.get_rotation(), transform.get_parent()); float disappearanceDelay = monsterSpawnCellDefinition.disappearanceDelay; if (disappearanceDelay > 0f) { yield return((object)new WaitForTime(disappearanceDelay)); } } monsterSpawnCellDefinition.DestroyInstance(instance); }
/// <summary> /// Initializes the audio manager. /// </summary> public void Init() { this.Stations = new List <AudioReference>(); this.StationsById = new Dictionary <uint, AudioReference>(); this.Modes = new List <AudioReference>(); var stationsRegEx = new Regex(@"music/stations/.*\.mp3"); foreach (var file in ContentManager.AllFiles) { if (stationsRegEx.IsMatch(file)) { var reference = new AudioReference { Type = AudioType.RADIO_STATION, FilePath = ContentManager.GetPath(file) }; Stations.Add(reference); var idString = Path.GetFileNameWithoutExtension(file); idString = idString.Substring(idString.LastIndexOf("_") + 1); var id = Convert.ToUInt32(idString, 16); reference.ID = id; StationsById.Add(id, reference); } } TSOAudio = new DBPFFile(ContentManager.GetPath("TSOAudio.dat")); tsov2 = new DBPFFile(ContentManager.GetPath("tsov2.dat")); Stings = new DBPFFile(ContentManager.GetPath("Stings.dat")); EP5Samps = new DBPFFile(ContentManager.GetPath("EP5Samps.dat")); EP2 = new DBPFFile(ContentManager.GetPath("EP2.dat")); Hitlists = new DBPFFile(ContentManager.GetPath("HitListsTemp.dat")); SFXCache = new Dictionary <uint, SoundEffect>(); TracksById = new Dictionary <uint, Track>(); HitlistsById = new Dictionary <uint, Hitlist>(); AddTracksFrom(TSOAudio); }
/// <summary> /// Initializes the audio manager. /// </summary> public void Init() { if (Initialized) { return; } this.Stations = new List <AudioReference>(); this.StationsById = new Dictionary <uint, AudioReference>(); this.Modes = new List <AudioReference>(); var stationsRegEx = new Regex(@"music/stations/.*\.mp3"); foreach (var file in ContentManager.AllFiles) { if (stationsRegEx.IsMatch(file)) { var reference = new AudioReference { Type = AudioType.RADIO_STATION, FilePath = ContentManager.GetPath(file) }; Stations.Add(reference); var idString = Path.GetFileNameWithoutExtension(file); idString = idString.Substring(idString.LastIndexOf("_") + 1); var id = Convert.ToUInt32(idString, 16); reference.ID = id; StationsById.Add(id, reference); } } TSOAudio = new DBPFFile(ContentManager.GetPath("TSOAudio.dat")); tsov2 = new DBPFFile(ContentManager.GetPath("tsov2.dat")); Stings = new DBPFFile(ContentManager.GetPath("Stings.dat")); EP5Samps = new DBPFFile(ContentManager.GetPath("EP5Samps.dat")); EP2 = new DBPFFile(ContentManager.GetPath("EP2.dat")); Hitlists = new DBPFFile(ContentManager.GetPath("HitListsTemp.dat")); SFXCache = new Dictionary <uint, SoundEffect>(); TracksById = new Dictionary <uint, Track>(); TracksByBackupId = new Dictionary <uint, Track>(); HitlistsById = new Dictionary <uint, Hitlist>(); AddTracksFrom(TSOAudio); //load events _Events = new Dictionary <string, HITEventRegistration>(); var content = ContentManager; var newmain = LoadHitGroup(content.GetPath("sounddata/newmain.hit"), content.GetPath("sounddata/eventlist.txt"), content.GetPath("sounddata/newmain.hsm")); var relationships = LoadHitGroup(content.GetPath("sounddata/relationships.hit"), content.GetPath("sounddata/relationships.evt"), content.GetPath("sounddata/relationships.hsm")); var tsoep5 = LoadHitGroup(content.GetPath("sounddata/tsoep5.hit"), content.GetPath("sounddata/tsoep5.evt"), content.GetPath("sounddata/tsoep5.hsm")); var tsoV2 = LoadHitGroup(content.GetPath("sounddata/tsov2.hit"), content.GetPath("sounddata/tsov2.evt"), null); //tsov2 has no hsm file var tsov3 = LoadHitGroup(content.GetPath("sounddata/tsov3.hit"), content.GetPath("sounddata/tsov3.evt"), content.GetPath("sounddata/tsov3.hsm")); var turkey = LoadHitGroup(content.GetPath("sounddata/turkey.hit"), content.GetPath("sounddata/turkey.evt"), content.GetPath("sounddata/turkey.hsm")); RegisterEvents(newmain); RegisterEvents(relationships); RegisterEvents(tsoep5); RegisterEvents(tsoV2); RegisterEvents(tsov3); RegisterEvents(turkey); //register the .xa files over in the nightclub folders. var files = Directory.GetFiles(content.GetPath("sounddata/nightclubsounds/")); foreach (var file in files) { if (!file.EndsWith(".xa")) { continue; } var split = file.Split('_'); uint id = 0; try { var endSplit = split[split.Length - 1]; id = Convert.ToUInt32("0x" + endSplit.Substring(0, endSplit.Length - 3), 16); } catch { continue; } NightclubSounds[id] = file; } Initialized = true; }