예제 #1
0
    public void Stop(Sounds.SOUND sound)
    {
        Sound soundToStop = getSound(sound);

        if (soundToStop == null)
        {
            return;
        }
        soundToStop.Stop();
    }
예제 #2
0
    public void Play(Sounds.SOUND sound)
    {
        Sound soundToPlay = getSound(sound);

        if (soundToPlay == null)
        {
            return;
        }
        soundToPlay.Play();
    }
예제 #3
0
    public Sound createSound(Sounds.SOUND sound)
    {
        Sound soundToClone = sounds.Find(soundItem => soundItem.name == sound);
        Sound newSound     = new Sound();

        newSound.volume      = soundToClone.volume;
        newSound.pitch       = soundToClone.pitch;
        newSound.name        = soundToClone.name;
        newSound.loop        = soundToClone.loop;
        newSound.audioClip   = soundToClone.audioClip;
        newSound.playOnAwake = soundToClone.playOnAwake;
        newSound.setAudioSource(gameObject.AddComponent <AudioSource>());
        allSounds.Add(newSound);
        if (isAudioOn)
        {
            newSound.mute();
        }
        return(newSound);
    }
예제 #4
0
 public Sound getSound(Sounds.SOUND sound)
 {
     return(sounds.Find(soundItem => soundItem.name == sound));
 }