인풋 처리하기
This commit is contained in:
parent
aa77cd9716
commit
9d78f53ba3
@ -37,11 +37,3 @@ void ABasePawn::Tick(float DeltaTime)
|
|||||||
Super::Tick(DeltaTime);
|
Super::Tick(DeltaTime);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called to bind functionality to input
|
|
||||||
void ABasePawn::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
|
|
||||||
{
|
|
||||||
Super::SetupPlayerInputComponent(PlayerInputComponent);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -36,7 +36,4 @@ public:
|
|||||||
// Called every frame
|
// Called every frame
|
||||||
virtual void Tick(float DeltaTime) override;
|
virtual void Tick(float DeltaTime) override;
|
||||||
|
|
||||||
// Called to bind functionality to input
|
|
||||||
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -14,3 +14,14 @@ ATank::ATank()
|
|||||||
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
|
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
|
||||||
Camera->SetupAttachment(SpringArm);
|
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);
|
||||||
|
}
|
@ -17,6 +17,9 @@ class TOONTANKS_API ATank : public ABasePawn
|
|||||||
public:
|
public:
|
||||||
ATank();
|
ATank();
|
||||||
|
|
||||||
|
// Called to bind functionality to input
|
||||||
|
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true"))
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true"))
|
||||||
class USpringArmComponent* SpringArm;
|
class USpringArmComponent* SpringArm;
|
||||||
@ -24,4 +27,5 @@ private:
|
|||||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true"))
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true"))
|
||||||
class UCameraComponent* Camera;
|
class UCameraComponent* Camera;
|
||||||
|
|
||||||
|
void Move(float Value);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user