public void PlayWhiffSFX(int playerIndex, EWhiffSFXType whiffSFXType) { if (whiffSFXType != EWhiffSFXType.None) { EAttackSFXType attackSFXType = ConvertWhiffToAttackSFXType(whiffSFXType); AudioSource sourceToPlay = (playerIndex == 0) ? m_Player1WhiffSFXAudioSource : m_Player2WhiffSFXAudioSource; AudioEntry[] attackSFXList = m_AttackSFX[(int)attackSFXType].m_SFXList; AudioEntry attackSFXToPlay = attackSFXList[Random.Range(0, attackSFXList.Length)]; sourceToPlay.clip = attackSFXToPlay.m_Clip; sourceToPlay.volume = attackSFXToPlay.m_Volume; sourceToPlay.Play(); } }
private EAttackSFXType ConvertWhiffToAttackSFXType(EWhiffSFXType whiffSFXType) { switch (whiffSFXType) { case EWhiffSFXType.Whiff_LP: return(EAttackSFXType.Whiff_LP); case EWhiffSFXType.Whiff_LK: return(EAttackSFXType.Whiff_LK); case EWhiffSFXType.Whiff_HP: return(EAttackSFXType.Whiff_HP); case EWhiffSFXType.Whiff_HK: return(EAttackSFXType.Whiff_HK); case EWhiffSFXType.Whiff_Parry: return(EAttackSFXType.Whiff_Parry); case EWhiffSFXType.None: default: return(EAttackSFXType.Whiff_LP); } }