From c8b3fb37c0d3d998a0677fccdc6fa637c857dd64 Mon Sep 17 00:00:00 2001 From: PHILIP WHITE Date: Sat, 27 Jan 2024 15:10:34 +0000 Subject: [PATCH] Update Character for Zooming In and Out via Scroll --- .../TopDown/Blueprints/BP_SeagullPlayer.uasset | 4 ++-- .../TopDown/Input/Actions/IAS_Scroll.uasset | 3 +++ .../TopDown/Input/IMC_DefaultMain.uasset | 4 ++-- .../8/4X/3W1TJMD96Q8MJD7QM7AWU7.uasset | 2 +- .../Source/SeagullGame/SeagullGameCharacter.cpp | 17 +++++++++++++++++ .../Source/SeagullGame/SeagullGameCharacter.h | 6 ++++++ 6 files changed, 31 insertions(+), 5 deletions(-) create mode 100644 SeagullGame/Content/TopDown/Input/Actions/IAS_Scroll.uasset diff --git a/SeagullGame/Content/TopDown/Blueprints/BP_SeagullPlayer.uasset b/SeagullGame/Content/TopDown/Blueprints/BP_SeagullPlayer.uasset index 9de3d04..91918af 100644 --- a/SeagullGame/Content/TopDown/Blueprints/BP_SeagullPlayer.uasset +++ b/SeagullGame/Content/TopDown/Blueprints/BP_SeagullPlayer.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1a37b07bcc159972cb632757e2efd7b5a468a0634aea54231c741dc4be5b91ad -size 293693 +oid sha256:79963f5fc78176d808a7553d4d376bb4bc92f7eca25403a19217c8126a215dd7 +size 294972 diff --git a/SeagullGame/Content/TopDown/Input/Actions/IAS_Scroll.uasset b/SeagullGame/Content/TopDown/Input/Actions/IAS_Scroll.uasset new file mode 100644 index 0000000..f651618 --- /dev/null +++ b/SeagullGame/Content/TopDown/Input/Actions/IAS_Scroll.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de17c4157c3d8cb85aee0e70602a57a274c25e14c555bc6a7b7595682a198e19 +size 1504 diff --git a/SeagullGame/Content/TopDown/Input/IMC_DefaultMain.uasset b/SeagullGame/Content/TopDown/Input/IMC_DefaultMain.uasset index afb26db..c4c8331 100644 --- a/SeagullGame/Content/TopDown/Input/IMC_DefaultMain.uasset +++ b/SeagullGame/Content/TopDown/Input/IMC_DefaultMain.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:25e89c763885e45caa0a3398b5776297a3fd79077856c95269baa8b2f11d30a4 -size 14721 +oid sha256:933630eee866405606ed7a3a8aa6053ea8dd048239ee85078edf35fa38279749 +size 15308 diff --git a/SeagullGame/Content/__ExternalActors__/TopDown/Maps/TopDownMap/8/4X/3W1TJMD96Q8MJD7QM7AWU7.uasset b/SeagullGame/Content/__ExternalActors__/TopDown/Maps/TopDownMap/8/4X/3W1TJMD96Q8MJD7QM7AWU7.uasset index 75c33ef..1ada753 100644 --- a/SeagullGame/Content/__ExternalActors__/TopDown/Maps/TopDownMap/8/4X/3W1TJMD96Q8MJD7QM7AWU7.uasset +++ b/SeagullGame/Content/__ExternalActors__/TopDown/Maps/TopDownMap/8/4X/3W1TJMD96Q8MJD7QM7AWU7.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:521c8ad82b026a0639b01a9f5836e0f2a1377207bf3360f273f986e3df20f486 +oid sha256:d1182e4a03d87df9f208c50cca105f6595c3d3a622675fa8adea9dc4c137f019 size 7066 diff --git a/SeagullGame/Source/SeagullGame/SeagullGameCharacter.cpp b/SeagullGame/Source/SeagullGame/SeagullGameCharacter.cpp index 4beb3e4..2448f22 100644 --- a/SeagullGame/Source/SeagullGame/SeagullGameCharacter.cpp +++ b/SeagullGame/Source/SeagullGame/SeagullGameCharacter.cpp @@ -172,6 +172,20 @@ void ASeagullGameCharacter::CrouchActionUnPressed(const FInputActionValue& Value StaticMeshComponent->SetVisibility(false); } +void ASeagullGameCharacter::Scroll(const FInputActionValue& Value) +{ + float ScrollAmount = Value.Get() * -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); } } diff --git a/SeagullGame/Source/SeagullGame/SeagullGameCharacter.h b/SeagullGame/Source/SeagullGame/SeagullGameCharacter.h index ed35496..df7a478 100644 --- a/SeagullGame/Source/SeagullGame/SeagullGameCharacter.h +++ b/SeagullGame/Source/SeagullGame/SeagullGameCharacter.h @@ -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();