Update Character for Zooming In and Out via Scroll
This commit is contained in:
parent
e8edfaf51d
commit
c8b3fb37c0
BIN
SeagullGame/Content/TopDown/Blueprints/BP_SeagullPlayer.uasset
(Stored with Git LFS)
BIN
SeagullGame/Content/TopDown/Blueprints/BP_SeagullPlayer.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
SeagullGame/Content/TopDown/Input/Actions/IAS_Scroll.uasset
(Stored with Git LFS)
Normal file
BIN
SeagullGame/Content/TopDown/Input/Actions/IAS_Scroll.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
SeagullGame/Content/TopDown/Input/IMC_DefaultMain.uasset
(Stored with Git LFS)
BIN
SeagullGame/Content/TopDown/Input/IMC_DefaultMain.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
SeagullGame/Content/__ExternalActors__/TopDown/Maps/TopDownMap/8/4X/3W1TJMD96Q8MJD7QM7AWU7.uasset
(Stored with Git LFS)
BIN
SeagullGame/Content/__ExternalActors__/TopDown/Maps/TopDownMap/8/4X/3W1TJMD96Q8MJD7QM7AWU7.uasset
(Stored with Git LFS)
Binary file not shown.
@ -172,6 +172,20 @@ void ASeagullGameCharacter::CrouchActionUnPressed(const FInputActionValue& Value
|
||||
StaticMeshComponent->SetVisibility(false);
|
||||
}
|
||||
|
||||
void ASeagullGameCharacter::Scroll(const FInputActionValue& Value)
|
||||
{
|
||||
float ScrollAmount = Value.Get<float>() * -1;
|
||||
CameraBoom->TargetArmLength += ScrollAmount * 100;
|
||||
if (CameraBoom->TargetArmLength < 300)
|
||||
{
|
||||
CameraBoom->TargetArmLength = 300;
|
||||
}
|
||||
if (CameraBoom->TargetArmLength > 1400)
|
||||
{
|
||||
CameraBoom->TargetArmLength = 1400;
|
||||
}
|
||||
}
|
||||
|
||||
void ASeagullGameCharacter::PickupItem()
|
||||
{
|
||||
OnPlayerPickupItem.Broadcast();
|
||||
@ -249,6 +263,9 @@ void ASeagullGameCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInp
|
||||
//Crouch
|
||||
EnhancedInputComponent->BindAction(CrouchAction, ETriggerEvent::Started, this, &ASeagullGameCharacter::CrouchActionPressed);
|
||||
EnhancedInputComponent->BindAction(CrouchAction, ETriggerEvent::Completed, this, &ASeagullGameCharacter::CrouchActionUnPressed);
|
||||
|
||||
//Scroll
|
||||
EnhancedInputComponent->BindAction(ScrollAction, ETriggerEvent::Triggered, this, &ASeagullGameCharacter::Scroll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,10 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||
class UInputAction* LookAction;
|
||||
|
||||
/** Scroll Input Action */
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||
class UInputAction* ScrollAction;
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Health")
|
||||
@ -93,6 +97,8 @@ public:
|
||||
void CrouchActionPressed(const FInputActionValue& Value);
|
||||
UFUNCTION(Category = "General")
|
||||
void CrouchActionUnPressed(const FInputActionValue& Value);
|
||||
UFUNCTION(Category = "General")
|
||||
void Scroll(const FInputActionValue& Value);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Item")
|
||||
void PickupItem();
|
||||
|
Loading…
Reference in New Issue
Block a user