Exemple #1
0
    public void UpdatePlayerSide()
    {
        Profiler.BeginSample("PlayerMovementComponent.UpdatePlayerSide");
        if (m_IsLeftSide)
        {
            if (m_Enemy.position.x < transform.position.x)
            {
                OnSideChanged();
            }
        }
        else
        {
            if (m_Enemy.position.x > transform.position.x)
            {
                OnSideChanged();
            }
        }

        if (m_NeedFlip)
        {
            // If we're not stunned AND not jumping AND not attacking
            if (!m_HealthComponent.GetStunInfoSubComponent().IsStunned() && !IsJumping() && !m_JumpTakeOffRequested && m_JumpPhase == EJumpPhase.None && m_AttackComponent.GetCurrentAttack() == null)
            {
                // If movement is not blocked OR blocked by time over => Then we can flip
                if (!m_IsMovementBlocked || m_MovementBlockedReason == EBlockedReason.TimeOver)
                {
                    Flip();
                    m_Animator.SetTrigger(K_ANIM_TURN_AROUND_TRIGGER);
                }
            }
        }

        Profiler.EndSample();
    }
Exemple #2
0
 void DisplayAttack()
 {
     if (m_TextToDisplayAttacks != null)
     {
         if (m_PlayerAttackComponentToDisplay.GetCurrentAttack() != null && m_PlayerAttackComponentToDisplay.GetCurrentAttack() != m_CurrentDisplayAttack)
         {
             m_TextToDisplayAttacks.text = m_PlayerAttackComponentToDisplay.GetCurrentAttack().m_Name + " launched !";
             m_DislayAttacksTimeStamp    = Time.time;
             m_CurrentDisplayAttack      = m_PlayerAttackComponentToDisplay.GetCurrentAttack();
         }
         else if (Time.time > m_DislayAttacksTimeStamp + s_DisplayAttacksTime)
         {
             ResetDisplayAttack();
         }
     }
 }
Exemple #3
0
    private bool IsInBlockingStance_Internal()
    {
        if (m_StunInfoSC.IsBlockStunned())
        {
            return(true);
        }

        bool canBlockAttack = true;

        if (m_AttackComponent)
        {
            // Check if we are not attacking
            canBlockAttack &= (m_AttackComponent.GetCurrentAttack() == null);
        }

        if (m_MovementComponent)
        {
            // If he's moving back and not jumping/taking off
            canBlockAttack &= (m_MovementComponent.IsMovingBack() && !m_MovementComponent.IsJumping() && !m_MovementComponent.IsJumpTakeOffRequested());
        }

        return(canBlockAttack);
    }