Bugfix ALS Sprint not Triggering

This commit is contained in:
Philip W 2024-03-13 17:28:18 +00:00
parent 0cbfbd0625
commit cd9baf6858
6 changed files with 19 additions and 18 deletions

View File

@ -97,8 +97,8 @@ void AEndlessVendettaCharacter::BeginPlay()
} }
InventoryComponent = Cast<UInventoryComponent>(GetComponentByClass(UInventoryComponent::StaticClass())); InventoryComponent = Cast<UInventoryComponent>(GetComponentByClass(UInventoryComponent::StaticClass()));
WalkSpeed = CharacterMovement->MaxWalkSpeed; //WalkSpeed = CharacterMovement->MaxWalkSpeed;
OriginalWalkSpeed = CharacterMovement->MaxWalkSpeed; //OriginalWalkSpeed = CharacterMovement->MaxWalkSpeed;
CurrentStamina = MaxStamina; CurrentStamina = MaxStamina;
CurrentHealth = DefaultHealth; CurrentHealth = DefaultHealth;
} }
@ -134,7 +134,7 @@ void AEndlessVendettaCharacter::Tick(float DeltaTime)
{ {
bIsPlayerSprinting = false; bIsPlayerSprinting = false;
CurrentStamina = 0.0f; CurrentStamina = 0.0f;
CharacterMovement->MaxWalkSpeed = OriginalWalkSpeed; //CharacterMovement->MaxWalkSpeed = OriginalWalkSpeed;
} }
} }
} }
@ -202,8 +202,8 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent*
//Moving //Moving
// EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Move); // EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Move);
// EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::Sprint); EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::Sprint);
// EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Completed, this, &AEndlessVendettaCharacter::StopSprint); EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Completed, this, &AEndlessVendettaCharacter::StopSprint);
//Looking //Looking
// EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Look); // EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Look);
@ -223,7 +223,7 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent*
EnhancedInputComponent->BindAction(GunAimInAction, ETriggerEvent::Completed, this, &AEndlessVendettaCharacter::StopGunRightClick); EnhancedInputComponent->BindAction(GunAimInAction, ETriggerEvent::Completed, this, &AEndlessVendettaCharacter::StopGunRightClick);
//Weapon Reloading //Weapon Reloading
EnhancedInputComponent->BindAction(GunReloadAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::GunReload); EnhancedInputComponent->BindAction(GunReloadAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::GunReload);
//Crouching //Crouching
EnhancedInputComponent->BindAction(CrouchAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::SetCrouch); EnhancedInputComponent->BindAction(CrouchAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::SetCrouch);
@ -635,6 +635,7 @@ void AEndlessVendettaCharacter::StopGunRightClick()
void AEndlessVendettaCharacter::GunReload() void AEndlessVendettaCharacter::GunReload()
{ {
if (bIsReloading) return;
if (InPauseMenu) return; if (InPauseMenu) return;
if (IsValid(PrimaryWeapon)) if (IsValid(PrimaryWeapon))
{ {
@ -681,7 +682,7 @@ void AEndlessVendettaCharacter::Sprint()
{ {
if (MoveGroundSpeed > 0) if (MoveGroundSpeed > 0)
{ {
CharacterMovement->MaxWalkSpeed = SprintSpeed; //CharacterMovement->MaxWalkSpeed = SprintSpeed;
} }
} }
} }
@ -692,7 +693,7 @@ void AEndlessVendettaCharacter::StopSprint()
if (!bIsPlayerSprinting) if (!bIsPlayerSprinting)
{ {
UE_LOG(LogTemp, Display, TEXT("Player stopped sprinting")); UE_LOG(LogTemp, Display, TEXT("Player stopped sprinting"));
CharacterMovement->MaxWalkSpeed = OriginalWalkSpeed; //CharacterMovement->MaxWalkSpeed = OriginalWalkSpeed;
} }
} }