diff --git a/Content/Legumix/Player/BP_Play.uasset b/Content/Legumix/Player/BP_Play.uasset index e500e1d..a87f56d 100644 --- a/Content/Legumix/Player/BP_Play.uasset +++ b/Content/Legumix/Player/BP_Play.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:973fb0d750dde56316e316c53ae8a39f1afba4726b68b700caaea1f09d6d519d -size 289 +oid sha256:c712426efc6aa24de45a1566fd721b38d496f61f004f0333f50d199edcf57ad1 +size 850125 diff --git a/Source/LegumeMix/Private/Player/LMMovementComponent.cpp b/Source/LegumeMix/Private/Player/LMMovementComponent.cpp index 5161537..312dc05 100644 --- a/Source/LegumeMix/Private/Player/LMMovementComponent.cpp +++ b/Source/LegumeMix/Private/Player/LMMovementComponent.cpp @@ -157,6 +157,7 @@ void ULMMovementComponent::EnterSlide() bWantsToCrouch = true; Velocity += Velocity.GetSafeNormal2D() * SlideEnterImpulse; SetMovementMode(EMovementMode::MOVE_Custom, ECustomMovementModes::ECMM_Sliding); + OnSlideStarted.Broadcast(); } void ULMMovementComponent::ExitSlide() @@ -167,6 +168,7 @@ void ULMMovementComponent::ExitSlide() FHitResult Hit; SafeMoveUpdatedComponent(FVector::ZeroVector, NewRotation, true, Hit); SetMovementMode(EMovementMode::MOVE_Walking); + OnSlideEnded.Broadcast(); } void ULMMovementComponent::PhysSlide(float DeltaTime, int32 Iterations) diff --git a/Source/LegumeMix/Private/Player/LMPlayer.cpp b/Source/LegumeMix/Private/Player/LMPlayer.cpp index 7ea275e..01c79ca 100644 --- a/Source/LegumeMix/Private/Player/LMPlayer.cpp +++ b/Source/LegumeMix/Private/Player/LMPlayer.cpp @@ -308,6 +308,7 @@ void ALMPlayer::DoLedgeGrabCheck() FVector TeleportLocation = FVector(Hit.Location.X, Hit.Location.Y, Hit.Location.Z + GetCapsuleComponent()->GetScaledCapsuleHalfHeight()); SetActorLocation(TeleportLocation, false, nullptr, ETeleportType::ResetPhysics); + OnLedgeGrab(); } } diff --git a/Source/LegumeMix/Public/Player/LMMovementComponent.h b/Source/LegumeMix/Public/Player/LMMovementComponent.h index ed1f5e2..8aee08e 100644 --- a/Source/LegumeMix/Public/Player/LMMovementComponent.h +++ b/Source/LegumeMix/Public/Player/LMMovementComponent.h @@ -10,6 +10,11 @@ class ALMPlayer; + +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnSlideStartedSignature); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnSlideEndedSignature); + + // See https://www.youtube.com/playlist?list=PLXJlkahwiwPmeABEhjwIALvxRSZkzoQpk UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent)) class LEGUMEMIX_API ULMMovementComponent : public UCharacterMovementComponent @@ -71,6 +76,11 @@ public: UFUNCTION(BlueprintCallable, Category="Legumix|Slide") void CrouchToggle(bool Toggle); + UPROPERTY(BlueprintAssignable, Category=Legumix) + FOnSlideStartedSignature OnSlideStarted; + UPROPERTY(BlueprintAssignable, Category=Legumix) + FOnSlideEndedSignature OnSlideEnded; + public: UPROPERTY(Transient) TObjectPtr PlayerCharacterOwner; diff --git a/Source/LegumeMix/Public/Player/LMPlayer.h b/Source/LegumeMix/Public/Player/LMPlayer.h index 50d7c22..38eb4db 100644 --- a/Source/LegumeMix/Public/Player/LMPlayer.h +++ b/Source/LegumeMix/Public/Player/LMPlayer.h @@ -111,6 +111,9 @@ public: UFUNCTION() void MovementChanged(ACharacter* Character, EMovementMode PrevMovementMode, uint8 PreviousCustomMode); + UFUNCTION(BlueprintImplementableEvent, Category=Legumix) + void OnLedgeGrab(); + UFUNCTION(BlueprintCallable) void DoLedgeGrabCheck();