public void PlaySoundAt(Vector3 pos, sounds clip) { GameObject sound = Instantiate(audioDad, pos, Quaternion.identity); sound.GetComponent <AudioSource>().PlayOneShot(clips[(int)clip]); Destroy(sound, clips[(int)clip].length + 0.1f); }
public static void MediaPlayerLoad(sounds sound) { switch (sound) { case sounds._321go: ((MainWindow)System.Windows.Application.Current.MainWindow).mediaPlayer.Open(new Uri($@".\Assets\Sound\321go.mp3", UriKind.Relative)); break; case sounds.bipbopsound: ((MainWindow)System.Windows.Application.Current.MainWindow).mediaPlayer.Open(new Uri($@".\Assets\Sound\bipbopsound.wav", UriKind.Relative)); break; case sounds.coindrop: ((MainWindow)System.Windows.Application.Current.MainWindow).mediaPlayer.Open(new Uri($@".\Assets\Sound\coindrop.wav", UriKind.Relative)); break; case sounds.gamemusic: ((MainWindow)System.Windows.Application.Current.MainWindow).mediaPlayer.Open(new Uri($@".\Assets\Sound\gamemusic.wav", UriKind.Relative)); break; case sounds.lightning: ((MainWindow)System.Windows.Application.Current.MainWindow).mediaPlayer.Open(new Uri($@".\Assets\Sound\lightning.mp3", UriKind.Relative)); break; case sounds.menumusic: ((MainWindow)System.Windows.Application.Current.MainWindow).mediaPlayer.Open(new Uri($@".\Assets\Sound\menumusic.wav", UriKind.Relative)); break; case sounds.pointcoundown: ((MainWindow)System.Windows.Application.Current.MainWindow).mediaPlayer.Open(new Uri($@".\Assets\Sound\pointcountdown.wav", UriKind.Relative)); break; } }
public void PlayMusic(int song) { string name = ""; switch (song) { case 0: name = "MenuTheme"; break; case 1: name = "Theme"; break; } sounds p = Array.Find(Sounds, sounds => sounds.Name == "MenuTheme"); p.source.Stop(); sounds q = Array.Find(Sounds, sounds => sounds.Name == "Theme"); q.source.Stop(); sounds s = Array.Find(Sounds, sounds => sounds.Name == name); s.source.Play(); }
public void PlaySoundGlobal(sounds clip) { GameObject sound = Instantiate(audioDad, cam.transform.position, Quaternion.identity, cam.transform); sound.GetComponent <AudioSource>().PlayOneShot(clips[(int)clip]); Destroy(sound, clips[(int)clip].length + 0.1f); }
protected override void SetupSounds() { for (int i = 0; i < Enum.GetNames(typeof(sounds)).Length; i++) { sounds name = (sounds)i; AddSound2D(name.ToString()); } }
// Use this for initialization void Start() { selectedNum = Random.Range(50, 100); sounds = GameObject.FindGameObjectWithTag("Player").GetComponent <sounds>(); //GameObject.FindGameObjectsWithTag("NPC"); }
protected override void SetupSounds() { base.SetIgnore("Door"); for (int i = 0; i < Enum.GetNames(typeof(sounds)).Length; i++) { sounds name = (sounds)i; AddSound3D(name.ToString()); } }
public void Play(string name) { sounds s = ArrayList.Find(sounds, sounds => sounds.name == name); if (s == null) { Debug.LogWarning("sound: " + name + " not found!"); return; } s.source.Play(); }
public void playOnce(string name) { sounds s = Array.Find(sounds, sound => sound.name == name); if (s == null) { Debug.Log("Sound : " + name + " Not found"); return; } s.source.Play(); }
public void Play(string name, ulong delay) { sounds s = Array.Find(sound, sounds => sounds.name == name); if (s == null) { Debug.LogWarning("Sound: " + name + " not found"); return; } s.source.Play(delay); }
// Update is called once per frame public void Play(string name) { sounds s = Array.Find(sounds, sounds => sounds.name == name); if (s == null) { Debug.LogWarning(" Sound: " + name + " not found!"); return; } s.source.Play(); //call by this statement FindObjectOfType<AudioManager>().Play("NameOfAudioClip"); }
private sounds CheckSound(string name) { sounds s = Array.Find(Sounds, sounds => sounds.Name == name); if (s == null) { Debug.LogWarning("Sound:" + name + "not found!"); return(null); } return(s); }
public void Play1(int index) { if (index < sound.Length) { sounds s = sound [index]; //Array.Find(sound, sounds => sounds.name == name); if (s == null) { //Debug.LogWarning ("Sound: " + name + " not found"); return; } s.source.Play(); } }
public void create() { sounds Component1 = data.GetComponent <sounds>(); volume = Component1.volume; for (int i = 1; i < 9; i++) { var pointer = Instantiate(pref) as GameObject; pointer.transform.SetParent(can.transform); pointer.transform.position = new Vector2(-100f + i * 22f, -100 + 10 * volume[i]); } }
public string getword(int index) { string emptystr = ""; if (index < sound.Length) { sounds s = sound [index]; //Array.Find(sound, sounds => sounds.name == name); if (s == null) { //Debug.LogWarning ("Sound: " + name + " not found"); return(emptystr); } return(s.name); } return(emptystr); }
public void PlayMusic(sounds clip) { if (!GameObject.Find("jukebox")) { GameObject jukebox = Instantiate(audioDad, cam.transform.position, Quaternion.identity, cam.transform); jukebox.gameObject.name = "jukebox"; jukebox.GetComponent <AudioSource>().clip = clips[(int)clip]; jukebox.GetComponent <AudioSource>().loop = true; jukebox.GetComponent <AudioSource>().Play(); } else { GameObject.Find("jukebox").GetComponent <AudioSource>().clip = clips[(int)clip]; GameObject.Find("jukebox").GetComponent <AudioSource>().Play(); } }
public void Play(string name) { if (DisableSound) { return; } sounds s = CheckSound(name); if (s == null) { return; } s.source.Play(); // Debug.Log("played sound " + name); }
public string getletter(int index, int pos) { string emptystr = ""; if (index < sound.Length) { sounds s = sound [index]; //Array.Find(sound, sounds => sounds.name == name); if (s == null) { //Debug.LogWarning ("Sound: " + name + " not found"); return(emptystr); } //s.name.Substring (pos, 1); return(s.name.Substring(pos, 1)); } return(emptystr); }
public void Stop(sounds sound, bool immediate) { base.Stop(sound.ToString(), immediate); }
public void Stop(sounds sound) { base.Stop(sound.ToString()); }
public void Pause(sounds sound) { base.Pause(sound.ToString()); }
//======================================================================================================================== //======================================================================================================================== //Не трогать public void Play(sounds sound) { base.Play(sound.ToString()); }
public void PlaySound(sounds sound) { menuMusic = FMODUnity.RuntimeManager.CreateInstance(menuMusicSound); menuMusic.start(); }
// Use this for initialization void Start() { stats = GameObject.FindGameObjectWithTag("gm").GetComponent <playerStats>(); inv = GameObject.FindGameObjectWithTag("gm").GetComponent <Inventory>(); sounds = GameObject.FindGameObjectWithTag("Player").GetComponent <sounds>(); }
public void Stop(string name) { sounds s = Array.Find(sounds, sounds => sounds.name == name); s.source.Stop(); }
void Start() { controller = GetComponent <CharacterController>(); anim = GetComponent <Animator>(); sounds = GameObject.FindGameObjectWithTag("Player").GetComponent <sounds>(); }
//Plays the chosen sound. If a soundID is not specified, a random //sound will play from the chosen category. public void Play(sounds soundtype) { if (!Player [(int)soundtype].isPlaying) { Player [(int)soundtype].clip = Sounds [(int)soundtype, r.Next (0, 3)]; Player [(int)soundtype].Play (); } if (music_en) MusicCheck (); else StopPlaying (sounds.bg); }
//Stops a sound from playing, particularly useful for turning music off public void StopPlaying(sounds soundtype) { Player [(int)soundtype].Stop (); }