示例#1
0
    public static void PlaySound(SOUND currentSound)
    {
        if (currentSound == SOUND.ButtonClick)
        {
            instance.GetComponent <AudioSource>().PlayOneShot(instance.SoundDie);
        }

        if (currentSound == SOUND.die)
        {
            instance.GetComponent <AudioSource>().PlayOneShot(instance.SoundDie);
            instance.Invoke("PlaySoundDie", 0.8f);
        }
        if (currentSound == SOUND.Scored)
        {
            instance.GetComponent <AudioSource>().PlayOneShot(instance.SoundScored);
        }
    }
示例#2
0
    public static void PlaySound(soundsGame currentSound)
    {
        switch (currentSound)
        {
        case soundsGame.die:
        {
            instance.GetComponent <AudioSource>().PlayOneShot(instance.soundDie);
        }
        break;

        case soundsGame.hit:
        {
            instance.GetComponent <AudioSource>().PlayOneShot(instance.soundHit);
            instance.Invoke("PlaySoundDie", 0.3f);
        }
        break;

        case soundsGame.menu:
        {
            instance.GetComponent <AudioSource>().PlayOneShot(instance.soundMenu);
        }
        break;

        case soundsGame.point:
        {
            instance.GetComponent <AudioSource>().PlayOneShot(instance.soundPoint);
        }
        break;

        case soundsGame.wing:
        {
            instance.GetComponent <AudioSource>().PlayOneShot(instance.soundWing);
        }
        break;
        }
    }