public AudioClip GetSFXAudioClip(SoundFXTypes soundFXType)
    {
        switch (soundFXType)
        {
        case SoundFXTypes.Default:
            return(sfxInfo.defaultAudio);

            break;

        case SoundFXTypes.Jump:
            return(sfxInfo.jumpAudio);

            break;

        case SoundFXTypes.PlayerHit:
            return(sfxInfo.playerHitAudio);

            break;

        case SoundFXTypes.EnemyHit:
            return(sfxInfo.enemyHitAudio);

            break;

        case SoundFXTypes.ButtonPress:
            return(sfxInfo.buttonPressAudio);

            break;
        }

        return(null);
    }
    public void PlaySoundEffect(SoundFXTypes soundFXType)
    {
        AudioClip ac = GetSFXAudioClip(soundFXType);

        if (ac != null)
        {
            if (sfxAudioSource != null)
            {
                sfxAudioSource.PlayOneShot(ac);
            }
        }
        else
        {
            Debug.LogWarning("No valid audio given for SoundFXType.");
        }
    }
示例#3
0
    public AudioClip GetSFXAudioClip(SoundFXTypes soundFXType)
    {
        switch (soundFXType)
        {
        case SoundFXTypes.Default:
            return(sfxInfo.defaultAudio);

            break;

        case SoundFXTypes.ButtonPress:
            return(sfxInfo.buttonPressAudio);

            break;
        }

        return(null);
    }