Inheritance: MonoBehaviour
Example #1
0
        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);
        }
Example #2
0
        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;
            }
        }
Example #3
0
    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();
    }
Example #4
0
        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);
        }
Example #5
0
 protected override void SetupSounds()
 {
     for (int i = 0; i < Enum.GetNames(typeof(sounds)).Length; i++)
     {
         sounds name = (sounds)i;
         AddSound2D(name.ToString());
     }
 }
Example #6
0
    // Use this for initialization
    void Start()
    {
        selectedNum = Random.Range(50, 100);
        sounds      = GameObject.FindGameObjectWithTag("Player").GetComponent <sounds>();



        //GameObject.FindGameObjectsWithTag("NPC");
    }
Example #7
0
    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());
        }
    }
Example #8
0
    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();
    }
Example #9
0
    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();
    }
Example #10
0
    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);
    }
Example #11
0
    // 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);
    }
Example #13
0
 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();
     }
 }
Example #14
0
    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]);
        }
    }
Example #15
0
    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);
    }
Example #16
0
 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);
    }
Example #18
0
    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);
    }
Example #19
0
 public void Stop(sounds sound, bool immediate)
 {
     base.Stop(sound.ToString(), immediate);
 }
Example #20
0
 public void Stop(sounds sound)
 {
     base.Stop(sound.ToString());
 }
Example #21
0
 public void Pause(sounds sound)
 {
     base.Pause(sound.ToString());
 }
Example #22
0
    //========================================================================================================================
    //========================================================================================================================
    //Не трогать

    public void Play(sounds sound)
    {
        base.Play(sound.ToString());
    }
Example #23
0
 public void PlaySound(sounds sound)
 {
     menuMusic = FMODUnity.RuntimeManager.CreateInstance(menuMusicSound);
     menuMusic.start();
 }
Example #24
0
 // Use this for initialization
 void Start()
 {
     stats  = GameObject.FindGameObjectWithTag("gm").GetComponent <playerStats>();
     inv    = GameObject.FindGameObjectWithTag("gm").GetComponent <Inventory>();
     sounds = GameObject.FindGameObjectWithTag("Player").GetComponent <sounds>();
 }
Example #25
0
    public void Stop(string name)
    {
        sounds s = Array.Find(sounds, sounds => sounds.name == name);

        s.source.Stop();
    }
Example #26
0
 void Start()
 {
     controller = GetComponent <CharacterController>();
     anim       = GetComponent <Animator>();
     sounds     = GameObject.FindGameObjectWithTag("Player").GetComponent <sounds>();
 }
Example #27
0
        //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);
        }
Example #28
0
 //Stops a sound from playing, particularly useful for turning music off
 public void StopPlaying(sounds soundtype)
 {
     Player [(int)soundtype].Stop ();
 }