Implemented slide inputs
Signed-off-by: TjgL <lithmoneo@gmail.com>
This commit is contained in:
parent
447dc6fbd4
commit
4cb72bb499
BIN
Content/Legumix/Player/BP_PlayerController.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Player/BP_PlayerController.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Legumix/Player/Input/IA_Slide.uasset
(Stored with Git LFS)
Normal file
BIN
Content/Legumix/Player/Input/IA_Slide.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Legumix/Player/Input/IMC_Default.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Player/Input/IMC_Default.uasset
(Stored with Git LFS)
Binary file not shown.
@ -116,11 +116,9 @@ bool ULMMovementComponent::CanCrouchInCurrentState() const
|
|||||||
|
|
||||||
void ULMMovementComponent::UpdateCharacterStateBeforeMovement(float DeltaSeconds)
|
void ULMMovementComponent::UpdateCharacterStateBeforeMovement(float DeltaSeconds)
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Log, TEXT("Velocity %f vs %f"), Velocity.SizeSquared(), pow(SlideMinSpeed, 2))
|
|
||||||
if (MovementMode == EMovementMode::MOVE_Walking && Safe_bPrevWantsToCrouch)
|
if (MovementMode == EMovementMode::MOVE_Walking && Safe_bPrevWantsToCrouch)
|
||||||
{
|
{
|
||||||
FHitResult PotentialSlideSurface;
|
FHitResult PotentialSlideSurface;
|
||||||
UE_LOG(LogTemp, Display, TEXT("PotentialSlideSurface"));
|
|
||||||
if (Velocity.SizeSquared() > pow(SlideMinSpeed, 2) && GetSlideSurface(PotentialSlideSurface))
|
if (Velocity.SizeSquared() > pow(SlideMinSpeed, 2) && GetSlideSurface(PotentialSlideSurface))
|
||||||
{
|
{
|
||||||
EnterSlide();
|
EnterSlide();
|
||||||
@ -260,5 +258,10 @@ void ULMMovementComponent::CrouchPressed()
|
|||||||
bWantsToCrouch = !bWantsToCrouch;
|
bWantsToCrouch = !bWantsToCrouch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ULMMovementComponent::CrouchToggle(bool Toggle)
|
||||||
|
{
|
||||||
|
bWantsToCrouch = Toggle;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "LMUserSettings.h"
|
#include "LMUserSettings.h"
|
||||||
#include "GameFramework/Character.h"
|
#include "GameFramework/Character.h"
|
||||||
#include "Kismet/GameplayStatics.h"
|
#include "Kismet/GameplayStatics.h"
|
||||||
|
#include "Player/LMMovementComponent.h"
|
||||||
#include "Player/LMPlayer.h"
|
#include "Player/LMPlayer.h"
|
||||||
#include "Weapon/LMWeaponManager.h"
|
#include "Weapon/LMWeaponManager.h"
|
||||||
|
|
||||||
@ -35,6 +36,8 @@ void ALMPlayerController::SetupInputComponent()
|
|||||||
Input->BindAction(ReloadAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Reload);
|
Input->BindAction(ReloadAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Reload);
|
||||||
Input->BindAction(ScrollAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Scroll);
|
Input->BindAction(ScrollAction, ETriggerEvent::Triggered, this, &ALMPlayerController::Scroll);
|
||||||
Input->BindAction(PauseAction, ETriggerEvent::Triggered, this, &ALMPlayerController::TogglePause);
|
Input->BindAction(PauseAction, ETriggerEvent::Triggered, this, &ALMPlayerController::TogglePause);
|
||||||
|
Input->BindAction(SlideAction, ETriggerEvent::Started, this, &ALMPlayerController::SlideInput);
|
||||||
|
Input->BindAction(SlideAction, ETriggerEvent::Completed, this, &ALMPlayerController::SlideCancel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,6 +82,19 @@ void ALMPlayerController::PauseInput(const FInputActionValue& InputValue)
|
|||||||
TogglePause();
|
TogglePause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ALMPlayerController::SlideInput(const FInputActionValue& InputValue)
|
||||||
|
{
|
||||||
|
LegumixPlayer->GetLegumixMovementComponent()->CrouchToggle(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ALMPlayerController::SlideCancel(const FInputActionValue& InputValue)
|
||||||
|
{
|
||||||
|
if (LegumixPlayer->GetLegumixMovementComponent()->bWantsToCrouch)
|
||||||
|
{
|
||||||
|
LegumixPlayer->GetLegumixMovementComponent()->CrouchToggle(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ALMPlayerController::TogglePause()
|
void ALMPlayerController::TogglePause()
|
||||||
{
|
{
|
||||||
const bool bIsPaused = UGameplayStatics::IsGamePaused(GetWorld());
|
const bool bIsPaused = UGameplayStatics::IsGamePaused(GetWorld());
|
||||||
|
@ -66,6 +66,11 @@ public:
|
|||||||
UFUNCTION(BlueprintPure)
|
UFUNCTION(BlueprintPure)
|
||||||
bool IsCustomMovementMode(ECustomMovementModes InCustomMovementMode) const;
|
bool IsCustomMovementMode(ECustomMovementModes InCustomMovementMode) const;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable, Category="Legumix|Slide")
|
||||||
|
void CrouchPressed();
|
||||||
|
UFUNCTION(BlueprintCallable, Category="Legumix|Slide")
|
||||||
|
void CrouchToggle(bool Toggle);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UPROPERTY(Transient)
|
UPROPERTY(Transient)
|
||||||
TObjectPtr<ALMPlayer> PlayerCharacterOwner;
|
TObjectPtr<ALMPlayer> PlayerCharacterOwner;
|
||||||
@ -88,7 +93,4 @@ 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;
|
||||||
|
|
||||||
UFUNCTION(BlueprintCallable, Category="Legumix|Slide")
|
|
||||||
void CrouchPressed();
|
|
||||||
};
|
};
|
||||||
|
@ -47,9 +47,13 @@ private:
|
|||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = true))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = true))
|
||||||
TObjectPtr<UInputAction> PauseAction;
|
TObjectPtr<UInputAction> PauseAction;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = true))
|
||||||
|
TObjectPtr<UInputAction> SlideAction;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess = true))
|
UPROPERTY(BlueprintReadOnly, meta = (AllowPrivateAccess = true))
|
||||||
TObjectPtr<ALMPlayer> LegumixPlayer;
|
TObjectPtr<ALMPlayer> LegumixPlayer;
|
||||||
|
|
||||||
|
|
||||||
virtual void SetupInputComponent() override;
|
virtual void SetupInputComponent() override;
|
||||||
void Move(const FInputActionValue& InputValue);
|
void Move(const FInputActionValue& InputValue);
|
||||||
@ -59,6 +63,8 @@ private:
|
|||||||
void Reload(const FInputActionValue& InputValue);
|
void Reload(const FInputActionValue& InputValue);
|
||||||
void Scroll(const FInputActionValue& InputValue);
|
void Scroll(const FInputActionValue& InputValue);
|
||||||
void PauseInput(const FInputActionValue& InputValue);
|
void PauseInput(const FInputActionValue& InputValue);
|
||||||
|
void SlideInput(const FInputActionValue& InputValue);
|
||||||
|
void SlideCancel(const FInputActionValue& InputValue);
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true, UIMin=0.01, ClampMin=0.01, UIMax=10.0, ClampMax=10.0))
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Legumix, meta = (AllowPrivateAccess = true, UIMin=0.01, ClampMin=0.01, UIMax=10.0, ClampMax=10.0))
|
||||||
float Sensitivity = 1.0f;
|
float Sensitivity = 1.0f;
|
||||||
|
Reference in New Issue
Block a user