示例#1
0
    /// <summary>
    /// Funzione che segue il knockback
    /// </summary>
    /// <param name="_dir"></param>
    /// <param name="_force"></param>
    public void ApplyKnockback(Vector3 _dir, float _force)
    {
        if (collisionCtrl.GetCollisionInfo().StickyCollision())
        {
            return;
        }

        Vector3 knockbackVector = Vector3.zero;

        if (Mathf.Sign(_dir.x) == Mathf.Sign(transform.right.normalized.x))
        {
            knockbackVector.x = _force;
        }
        else
        {
            knockbackVector.x = -_force;
        }

        movementCtrl.MovementCheck(knockbackVector);
    }