인풋 처리하기
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -35,8 +35,5 @@ private:
|
|||||||
public:
|
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);
|
||||||
|
}
|
@ -16,6 +16,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"))
|
||||||
@ -23,5 +26,6 @@ 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