Exemplo n.º 1
0
    private void CheckGrounded()
    {
        var colliderThreshold        = 0.05f;
        var topLeftOfGroundCheck     = new Vector2(playerBoxCollider.bounds.min.x, playerBoxCollider.bounds.min.y - colliderThreshold);
        var bottomRightOfGroundCheck = new Vector2(playerBoxCollider.bounds.max.x, playerBoxCollider.bounds.min.y - lengthToSearch);

        playerState = !CharacterFunctions.GroundCheck(topLeftOfGroundCheck, bottomRightOfGroundCheck) ? PlayerState.IN_AIR : PlayerState.GROUNDED;
    }