캐스팅

This commit is contained in:
강민제 2025-04-24 20:39:01 +09:00
parent 1aebda717b
commit 8e1f1c0e2a
4 changed files with 14 additions and 11 deletions

View File

@ -24,13 +24,6 @@ ABasePawn::ABasePawn()
ProjectileSpawnPoint->SetupAttachment(TurretMesh);
}
// Called when the game starts or when spawned
void ABasePawn::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ABasePawn::Tick(float DeltaTime)
{

View File

@ -15,10 +15,6 @@ public:
// Sets default values for this pawn's properties
ABasePawn();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true"))
class UCapsuleComponent* CapsuleComp;

View File

@ -23,6 +23,14 @@ void ATank::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
PlayerInputComponent->BindAxis(TEXT("Turn"), this, &ATank::Turn);
}
// Called when the game starts or when spawned
void ATank::BeginPlay()
{
Super::BeginPlay();
PlayerControllerRef = Cast<APlayerController>(GetController());
}
void ATank::Move(float Value)
{
FVector DeltaLocation = FVector::ZeroVector;

View File

@ -19,6 +19,10 @@ public:
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
private:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Component", meta=(AllowPrivateAccess = "true"))
@ -32,6 +36,8 @@ private:
UPROPERTY(EditAnywhere, Category = "Movement")
float TurnRate = 45.0f;
APlayerController* PlayerControllerRef;
void Move(float Value);