コード例 #1
0
    void OnGrabTry(BaseEventParameters baseParams)
    {
        if (IsDead())
        {
            return;
        }

        GrabTryEventParameters grabTryParams   = (GrabTryEventParameters)baseParams;
        PlayerBaseAttackLogic  grabAttackLogic = grabTryParams.m_AttackLogic;

        ChronicleManager.AddChronicle(gameObject, EChronicleCategory.Health, "On grab try");

        if (CanBlockGrabAttack(grabAttackLogic))
        {
            // Here, both players are currently playing grab attack
            // But one is the attacker, and the second the defender
            // Only the defender can trigger GrabBlocked event and start a block animation
            // If the player who's trying to grab is the first one to have triggered the grab attack, he's the attacker, so we can block it
            if (IsGrabAttacker(grabAttackLogic))
            {
                ChronicleManager.AddChronicle(gameObject, EChronicleCategory.Health, "On grab blocked");

                Utils.GetEnemyEventManager(gameObject).TriggerEvent(EPlayerEvent.GrabBlocked, new GrabBlockedEventParameters(grabAttackLogic));
                m_StunInfoSC.StartStun(grabAttackLogic, EAttackResult.Blocked);
                PlayBlockAnimation(grabAttackLogic);
            }
        }
        else if (!m_StunInfoSC.IsHitStunned() && !m_StunInfoSC.IsBlockStunned() && !m_MovementComponent.IsJumping()) // A grab can't touch if player is stunned or is jumping
        {
            ChronicleManager.AddChronicle(gameObject, EChronicleCategory.Health, "On grab touched");

            Utils.GetEnemyEventManager(gameObject).TriggerEvent(EPlayerEvent.GrabTouched, new GrabTouchedEventParameters(grabAttackLogic));
        }
    }
コード例 #2
0
    public virtual EHitNotificationType GetHitNotificationType(EAttackResult attackResult, bool isInBlockingStance, bool isCrouching, bool isFacingRight, PlayerAttackComponent victimAttackComponent)
    {
        if (victimAttackComponent.GetCurrentAttackLogic() != null)
        {
            EAttackState victimAttackState = victimAttackComponent.CurrentAttackState;
            if (victimAttackState == EAttackState.Startup || victimAttackState == EAttackState.Active)
            {
                return(EHitNotificationType.Counter);
            }
        }

        if (m_Attack.m_NeededStanceList.Contains(EPlayerStance.Jump) && m_MovementComponent.IsJumping())
        {
            if (m_CurrentCrossupCoroutine != null)
            {
                m_AttackComponent.StopCoroutine(m_CurrentCrossupCoroutine);
            }

            m_CurrentCrossupCoroutine = ValidateCrossup_Coroutine(victimAttackComponent.transform);
            m_AttackComponent.StartCoroutine(m_CurrentCrossupCoroutine);
        }

        return(EHitNotificationType.None);
    }