void HitEnemy(Collider2D _collider)
    {
        hitConfirmed = true;
        PlayerFSM _temp = _collider.gameObject.GetComponent <PlayerFSM>();

        m_highestCombo = m_currentCombo > m_highestCombo ? m_currentCombo : m_highestCombo;
        if (_temp.currentState == _temp.GetState(PlayerFSM.States.HIT) || _temp.currentState == _temp.GetState(PlayerFSM.States.BOUNCE))
        {
            m_currentCombo++;
        }
        else
        {
            m_currentCombo = 1;
        }
    }
Exemple #2
0
    void OnCollisionStay2D(Collision2D _collider)
    {
        if (!bounce)
        {
            if (_collider.collider.gameObject.layer == LayerMask.NameToLayer("Platform") || _collider.collider.gameObject.layer == LayerMask.NameToLayer("Floor"))
            {
                if (m_fsmReference.currentState == m_fsmReference.GetState(PlayerFSM.States.HIT))
                {
                    _collisionNormal  = Vector2.zero;
                    _collisionNormal += _collider.contacts[0].normal;

                    float vel = m_actorReference.GetPhysicsController().Velocity.y;
                    if (vel < -bounceThreshold)
                    {
                        bounce = true;
                        Bounce(vel);
                    }
                }
            }
        }
    }