From 6f28d139ac1dcf821036822596c72337e7281aeb Mon Sep 17 00:00:00 2001
From: MH261677 <mh261677@falmouth.ac.uk>
Date: Mon, 16 Jan 2023 20:44:47 +0000
Subject: [PATCH] Updated Interaction.cpp

Created camera movement functions and updating input disabler functions
---
 .../MerchantInteraction/Interaction.cpp          | 16 +++++++++++++---
 .../MerchantInteraction/Interaction.h            |  3 +++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp
index b6f63ab..86044f6 100644
--- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp
+++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp
@@ -8,7 +8,8 @@
 #include "Components/Button.h"
 #include "GameFramework/Character.h"
 #include "Components/WidgetComponent.h"
-
+#include "Evaluation/MovieSceneCameraAnimTemplate.h"
+#include "Kismet/KismetMathLibrary.h"
 
 
 // Sets default values
@@ -34,6 +35,7 @@ void AInteraction::Tick(float DeltaTime)
 
 void AInteraction::OnInteract()
 {
+	bDisableShopDialMove = true;
 	ShopDialogWidget = CreateWidget<UUserWidget>(GetWorld(), ShopDialog);
 	if (ShopDialogWidget == nullptr)
 	{
@@ -96,7 +98,11 @@ void AInteraction::CameraLeftMover()
 		}
 		else
 		{
-			UE_LOG(LogTemp, Display, TEXT("Camera functionality here in Interaction.cpp"));
+			FVector TargetLocation = FVector(1290, 530, 50);
+			FVector CameraLocation = MainCamera->GetComponentLocation();
+			FRotator CameraRotation = UKismetMathLibrary::FindLookAtRotation(CameraLocation, TargetLocation);
+			MainCamera->SetWorldRotation(CameraRotation);
+			MainCamera->SetFieldOfView(40);
 		}
 	}
 }
@@ -121,7 +127,11 @@ void AInteraction::CameraRightMover()
 		}
 		else
 		{
-			UE_LOG(LogTemp, Display, TEXT("Camera functionality here in Interaction.cpp"));
+			FVector TargetLocation = FVector(470, 510, 80);
+			FVector CameraLocation = MainCamera->GetComponentLocation();
+			FRotator CameraRotation = UKismetMathLibrary::FindLookAtRotation(CameraLocation, TargetLocation);
+			MainCamera->SetWorldRotation(CameraRotation);
+			MainCamera->SetFieldOfView(40);
 		}
 	}
 }
diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h
index 4231b2a..fb771a9 100644
--- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h
+++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h
@@ -46,6 +46,9 @@ public:
 	UPROPERTY()
 	bool bisDisabled = false;
 
+	UPROPERTY()
+	bool bDisableShopDialMove = false;
+
 	UFUNCTION(BlueprintCallable, Category= "ButtonLeft")
 	virtual void CameraLeftMover();