Implemented jump in slide

Signed-off-by: TjgL <lithmoneo@gmail.com>
This commit is contained in:
TjgL 2025-03-12 12:16:29 +01:00
parent 4cb72bb499
commit 715dcf5a91
4 changed files with 15 additions and 1 deletions

View File

@ -265,3 +265,9 @@ void ULMMovementComponent::CrouchToggle(bool Toggle)
#pragma endregion #pragma endregion
bool ULMMovementComponent::CanAttemptJump() const
{
return IsJumpAllowed() &&
(IsMovingOnGround() || IsFalling()); // Falling included for double-jump and non-zero jump hold time, but validated by character.
}

View File

@ -105,6 +105,11 @@ int ALMPlayer::RemoveAmmo(const EAmmoType AmmoType, const int Count) const
return WeaponManager->RemoveAmmo(AmmoType, Count); return WeaponManager->RemoveAmmo(AmmoType, Count);
} }
bool ALMPlayer::CanJumpInternal_Implementation() const
{
return JumpIsAllowedInternal();
}
void ALMPlayer::SetWeaponManager(ULMWeaponManager* Manager) void ALMPlayer::SetWeaponManager(ULMWeaponManager* Manager)
{ {
UE_LOG(LogTemp, Warning, TEXT("Set weapon manager")) UE_LOG(LogTemp, Warning, TEXT("Set weapon manager"))

View File

@ -93,4 +93,5 @@ private:
void ExitSlide(); void ExitSlide();
void PhysSlide(float DeltaTime, int32 Iterations); void PhysSlide(float DeltaTime, int32 Iterations);
bool GetSlideSurface(FHitResult& Hit) const; bool GetSlideSurface(FHitResult& Hit) const;
virtual bool CanAttemptJump() const override;
}; };

View File

@ -53,6 +53,8 @@ public:
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
int RemoveAmmo(EAmmoType AmmoType, int Count) const; int RemoveAmmo(EAmmoType AmmoType, int Count) const;
virtual bool CanJumpInternal_Implementation() const override;
protected: protected:
// Called when the game starts or when spawned // Called when the game starts or when spawned
virtual void BeginPlay() override; virtual void BeginPlay() override;