feat: 增加跑动共嗯那个
This commit is contained in:
@@ -51,3 +51,6 @@ ConnectionType=USBOnly
|
||||
bUseManualIPAddress=False
|
||||
ManualIPAddress=
|
||||
|
||||
[/Script/UnrealBuildTool.UnrealBuildTool]
|
||||
bAllowGitCommandlineIntegration=False
|
||||
|
||||
|
||||
Binary file not shown.
BIN
Content/Inputs/IA/IA_RunAction.uasset
LFS
Normal file
BIN
Content/Inputs/IA/IA_RunAction.uasset
LFS
Normal file
Binary file not shown.
Binary file not shown.
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
#include "EnhancedInputComponent.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
|
||||
void AMyCharacter::Move(const FInputActionValue& Value)
|
||||
{
|
||||
@@ -18,10 +19,12 @@ void AMyCharacter::Move(const FInputActionValue& Value)
|
||||
void AMyCharacter::BeginRun(const FInputActionValue& Value)
|
||||
{
|
||||
bIsRunning = true;
|
||||
GetCharacterMovement()->MaxWalkSpeed = 1200.0f;
|
||||
}
|
||||
void AMyCharacter::StopRun(const FInputActionValue& Value)
|
||||
{
|
||||
bIsRunning = false;
|
||||
GetCharacterMovement()->MaxWalkSpeed = 600.0f;
|
||||
}
|
||||
|
||||
// Sets default values
|
||||
@@ -68,6 +71,10 @@ void AMyCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCompone
|
||||
if (MoveAction) {
|
||||
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AMyCharacter::Move);
|
||||
}
|
||||
if (RunAction) {
|
||||
EnhancedInputComponent->BindAction(RunAction, ETriggerEvent::Started, this, &AMyCharacter::BeginRun);
|
||||
EnhancedInputComponent->BindAction(RunAction, ETriggerEvent::Completed, this, &AMyCharacter::StopRun);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user