Esempio n. 1
0
 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();
     }
 }
Esempio n. 2
0
    private void PlayHitSFX(PlayerBaseAttackLogic attackLogic, EAttackResult attackResult, EHitNotificationType hitNotificationType)
    {
        EAttackSFXType attackSFXType = EAttackSFXType.Hit_Light;

        bool validHitSFXFound = IsDead() || attackLogic.GetHitSFX(attackResult, hitNotificationType, ref attackSFXType);

        if (IsDead())
        {
            attackSFXType = EAttackSFXType.Final_Hit;
        }

        if (validHitSFXFound)
        {
            // Play attack SFX on the instigator of the hit in order to cancel whiff sfx
            m_AudioManager.PlayHitSFX(m_InfoComponent.GetPlayerIndex(), attackSFXType, attackLogic is PlayerProjectileAttackLogic);
        }
        else
        {
            KakutoDebug.LogError("No SFX found for attack " + attackLogic.GetAnimationAttackName() + " taken in " + attackResult);
            ChronicleManager.AddChronicle(gameObject, EChronicleCategory.Health, "No SFX found for attack " + attackLogic.GetAnimationAttackName() + " taken in " + attackResult);
        }
    }
Esempio n. 3
0
    public void PlayHitSFX(int playerVictimIndex, EAttackSFXType attackSFXType, bool isProjectileAttack)
    {
        AudioSource sourceToPlay = (playerVictimIndex == 0) ? m_Player1AttackSFXAudioSource : m_Player2AttackSFXAudioSource;

        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();

        // If projectile attack, stop whiff only on victim, else on both players
        if (isProjectileAttack)
        {
            AudioSource whiffSourceToStop = (playerVictimIndex == 0) ? m_Player1WhiffSFXAudioSource : m_Player2WhiffSFXAudioSource;
            whiffSourceToStop.Stop();
        }
        else
        {
            m_Player1WhiffSFXAudioSource.Stop();
            m_Player2WhiffSFXAudioSource.Stop();
        }

        if (attackSFXType == EAttackSFXType.Hit_Heavy)
        {
            float random = Random.Range(0f, 1f);
            if (random <= m_HeavyHitGruntSFX.m_GruntProbability)
            {
                AudioSource gruntSourceToPlay = (playerVictimIndex == 0) ? m_Player1HeavyHitGruntSFXAudioSource : m_Player2HeavyHitGruntSFXAudioSource;
                AudioEntry  gruntSFXToPlay    = m_HeavyHitGruntSFX.m_GruntSFX[Random.Range(0, m_HeavyHitGruntSFX.m_GruntSFX.Length)];
                gruntSourceToPlay.clip   = gruntSFXToPlay.m_Clip;
                gruntSourceToPlay.volume = gruntSFXToPlay.m_Volume;
                gruntSourceToPlay.Play();
            }
        }
    }
Esempio n. 4
0
    public override bool GetHitSFX(EAttackResult attackResult, EHitNotificationType hitNotifType, ref EAttackSFXType hitSFXType)
    {
        bool baseResult = base.GetHitSFX(attackResult, hitNotifType, ref hitSFXType);

        if (!baseResult)
        {
            switch (attackResult)
            {
            case EAttackResult.Hit:
                hitSFXType = EAttackSFXType.Hit_Heavy;
                return(true);
            }
        }

        return(baseResult);
    }
    public override bool GetHitSFX(EAttackResult attackResult, EHitNotificationType hitNotifType, ref EAttackSFXType hitSFXType)
    {
        switch (attackResult)
        {
        case EAttackResult.Hit:
            if (hitNotifType == EHitNotificationType.Counter)
            {
                hitSFXType = EAttackSFXType.Counter_Hit_Heavy;
                return(true);
            }
            else if (hitNotifType == EHitNotificationType.GuardCrush)
            {
                hitSFXType = EAttackSFXType.GuardCrush_Hit;
                return(true);
            }
            break;
        }

        return(base.GetHitSFX(attackResult, hitNotifType, ref hitSFXType));
    }
Esempio n. 6
0
    public virtual bool GetHitSFX(EAttackResult attackResult, EHitNotificationType hitNotifType, ref EAttackSFXType hitSFXType)
    {
        switch (attackResult)
        {
        case EAttackResult.Hit:
            if (IsHitKO())
            {
                hitSFXType = EAttackSFXType.Hit_KO;
                return(true);
            }

            if (m_Attack.m_AnimationAttackName >= EAnimationAttackName.Special01)
            {
                hitSFXType = EAttackSFXType.Hit_Special;
                return(true);
            }
            break;

        case EAttackResult.Blocked:
            hitSFXType = EAttackSFXType.Blocked_Hit;
            return(true);

        case EAttackResult.Parried:
            hitSFXType = EAttackSFXType.Parry_Hit;
            return(true);
        }

        return(false);
    }
Esempio n. 7
0
    public override bool GetHitSFX(EAttackResult attackResult, EHitNotificationType hitNotifType, ref EAttackSFXType hitSFXType)
    {
        bool baseResult = base.GetHitSFX(attackResult, hitNotifType, ref hitSFXType);

        if (!baseResult)
        {
            switch (attackResult)
            {
            case EAttackResult.Hit:
                switch (m_Config.m_HitStrength)
                {
                case EHitStrength.Weak:
                    hitSFXType = (hitNotifType == EHitNotificationType.Counter) ? EAttackSFXType.Counter_Hit_Light : EAttackSFXType.Hit_Light;
                    break;

                case EHitStrength.Strong:
                    hitSFXType = (hitNotifType == EHitNotificationType.Counter) ? EAttackSFXType.Counter_Hit_Heavy : EAttackSFXType.Hit_Heavy;
                    break;
                }
                return(true);
            }
        }

        return(baseResult);
    }
Esempio n. 8
0
    public AttackSFX(EAttackSFXType type)
    {
#if UNITY_EDITOR
        m_Name = type.ToString();
#endif
    }