public void StopSound(SoundTypes type) { foreach (AudioSource audio in AudioSources) { if (audio.name.Equals(type.ToString())) { audio.Stop(); return; } } }
void OnTriggerEnter2D(Collider2D c) { tfAnim.SetTrigger("Active"); var result = c.CompareTag(sound.ToString()); print("Affect Tuning: " + gameObject.name + ", Result: " + result); if (trick != null) { trick.Unlocked = result; } var anim = (result) ? "anim_happy" : "anim_sad"; faceAnim.Play(anim); if (onNoiseCb != null) { onNoiseCb(result); } }
/// <summary> /// Funkcja zwracajaca pelna sciezke do pliku dzwiekowego (mp3) po zadanym /// typie dzwieku do zagrania /// </summary> /// <param name="sound">Typ dzwieku</param> /// <returns>Pelna sciezka do pliku wav z dzwiekiem</returns> public String FindSound(SoundTypes sound) { return soundDirectoryPath + (String)resourcesManager.GetObject(sound.ToString()); }
private string GetFileName(SoundTypes file) { return((from s in Sounds where s.Name.ToLower().Equals(file.ToString().ToLower()) select s.File).FirstOrDefault()); }