Base functionality for MapObject placement
This commit is contained in:
+15
-1
@@ -28,6 +28,7 @@ AAdventureCameraPawn::AAdventureCameraPawn()
|
||||
ESAMinBoundSlope = -1 / ESASize;
|
||||
ESAMinBoundIntercept = 0 - (ESAMinBoundSlope * ESASize);
|
||||
|
||||
AutoPossessPlayer = EAutoReceiveInput::Player0;
|
||||
}
|
||||
|
||||
// Called when the game starts or when spawned
|
||||
@@ -36,7 +37,7 @@ void AAdventureCameraPawn::BeginPlay()
|
||||
Super::BeginPlay();
|
||||
ControllerRef = (AAdventurePlayerController*)UGameplayStatics::GetPlayerController(GetWorld(), 0);
|
||||
|
||||
// The Viewport properties are inaccurate right after BeginPlay, so we need to wait a short time before saving them here.
|
||||
// Viewport properties not accurate on BeginPlay (must wait before accessing)
|
||||
FTimerHandle UnusedHandle;
|
||||
GetWorldTimerManager().SetTimer(
|
||||
UnusedHandle, this, &AAdventureCameraPawn::GetTheDamnViewport, 1, false);
|
||||
@@ -63,8 +64,21 @@ void AAdventureCameraPawn::SetupPlayerInputComponent(UInputComponent* PlayerInpu
|
||||
{
|
||||
PlayerInputComponent->BindAxis("Mouse X", this, &AAdventureCameraPawn::EdgeScrollSide);
|
||||
PlayerInputComponent->BindAxis("Mouse Y", this, &AAdventureCameraPawn::EdgeScrollVert);
|
||||
|
||||
PlayerInputComponent->BindAxis("Move AD", this, &AAdventureCameraPawn::ScrollSide);
|
||||
PlayerInputComponent->BindAxis("Move WS", this, &AAdventureCameraPawn::ScrollVert);
|
||||
}
|
||||
}
|
||||
void AAdventureCameraPawn::ScrollSide(float AxisValue)
|
||||
{
|
||||
float DeltaLoc = AxisValue * BaseScrollSpeed * 3;
|
||||
AddActorLocalOffset(FVector(DeltaLoc, 0, 0));
|
||||
}
|
||||
void AAdventureCameraPawn::ScrollVert(float AxisValue)
|
||||
{
|
||||
float DeltaLoc = AxisValue * BaseScrollSpeed * -3;
|
||||
AddActorLocalOffset(FVector(0, DeltaLoc, 0));
|
||||
}
|
||||
|
||||
|
||||
void AAdventureCameraPawn::EdgeScrollSide(float AxisValue)
|
||||
|
||||
Reference in New Issue
Block a user