From 9d78f53ba3ec4858ac78cc49158de50118dc04aa Mon Sep 17 00:00:00 2001 From: 10000Je Date: Thu, 24 Apr 2025 00:58:47 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B8=ED=92=8B=20=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/ToonTanks/BasePawn.cpp | 8 -------- Source/ToonTanks/BasePawn.h | 5 +---- Source/ToonTanks/Tank.cpp | 11 +++++++++++ Source/ToonTanks/Tank.h | 6 +++++- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Source/ToonTanks/BasePawn.cpp b/Source/ToonTanks/BasePawn.cpp index b2f505d..e38882c 100644 --- a/Source/ToonTanks/BasePawn.cpp +++ b/Source/ToonTanks/BasePawn.cpp @@ -37,11 +37,3 @@ void ABasePawn::Tick(float DeltaTime) Super::Tick(DeltaTime); } - -// Called to bind functionality to input -void ABasePawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) -{ - Super::SetupPlayerInputComponent(PlayerInputComponent); - -} - diff --git a/Source/ToonTanks/BasePawn.h b/Source/ToonTanks/BasePawn.h index c0fa478..9e3673d 100644 --- a/Source/ToonTanks/BasePawn.h +++ b/Source/ToonTanks/BasePawn.h @@ -35,8 +35,5 @@ private: public: // Called every frame virtual void Tick(float DeltaTime) override; - - // Called to bind functionality to input - virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; - + }; diff --git a/Source/ToonTanks/Tank.cpp b/Source/ToonTanks/Tank.cpp index 1dd3652..c459915 100644 --- a/Source/ToonTanks/Tank.cpp +++ b/Source/ToonTanks/Tank.cpp @@ -14,3 +14,14 @@ ATank::ATank() Camera = CreateDefaultSubobject(TEXT("Camera")); Camera->SetupAttachment(SpringArm); } + +void ATank::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) +{ + Super::SetupPlayerInputComponent(PlayerInputComponent); + PlayerInputComponent->BindAxis(TEXT("MoveForward"), this, &ATank::Move); +} + +void ATank::Move(float Value) +{ + UE_LOG(LogTemp, Warning, TEXT("Move: %f"), Value); +} \ No newline at end of file diff --git a/Source/ToonTanks/Tank.h b/Source/ToonTanks/Tank.h index 81ef6d9..8a985c1 100644 --- a/Source/ToonTanks/Tank.h +++ b/Source/ToonTanks/Tank.h @@ -16,6 +16,9 @@ class TOONTANKS_API ATank : public ABasePawn public: ATank(); + + // Called to bind functionality to input + virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; private: UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true")) @@ -23,5 +26,6 @@ private: UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true")) class UCameraComponent* Camera; - + + void Move(float Value); };