From ab2d2118dd1060ab5da21fbb85b314b5742627c1 Mon Sep 17 00:00:00 2001
From: MH261677 <mh261677@falmouth.ac.uk>
Date: Mon, 16 Jan 2023 17:02:12 +0000
Subject: [PATCH] Updated Interaction.cpp

Added base functionality for both functions to make camera move
---
 .../MerchantInteraction/Interaction.cpp       | 23 ++++++++++++++++++-
 .../MerchantInteraction/Interaction.h         |  6 +++++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp
index 27c894f..df602b7 100644
--- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp
+++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp
@@ -4,6 +4,7 @@
 #include "Interaction.h"
 
 #include "Chaos/BoundingVolumeUtilities.h"
+#include "Components/Button.h"
 #include "Components/WidgetComponent.h"
 
 
@@ -52,6 +53,16 @@ void AInteraction::RemoveWidget()
 	ShopDialogWidget->RemoveFromViewport();
 	UE_LOG(LogTemp, Display, TEXT("setting isDisabled to true"));
 	ItemSelectorWidget = CreateWidget<UUserWidget>(GetWorld(), ItemSelector);
+	UProperty* Property = ItemSelectorWidget->GetClass()->FindPropertyByName("publicActor");
+	if (Property == nullptr)
+	{
+		UE_LOG(LogTemp, Error, TEXT("Property not found"));
+	}
+	else
+	{
+		FObjectPropertyBase* ObjectProperty = static_cast<FObjectPropertyBase*>(Property);
+		ObjectProperty->SetObjectPropertyValue(ObjectProperty->ContainerPtrToValuePtr<void>(ItemSelectorWidget), this);
+	}
 	if (ItemSelectorWidget == nullptr)
 	{
 		return;
@@ -61,4 +72,14 @@ void AInteraction::RemoveWidget()
 		ItemSelectorWidget->AddToViewport(0);
 		bisDisabled = false;
 	}
-}
\ No newline at end of file
+}
+
+void AInteraction::CameraLeftMover()
+{
+	UE_LOG(LogTemp, Display, TEXT("Button Left is being pressed"));
+}
+
+void AInteraction::CameraRightMover()
+{
+	UE_LOG(LogTemp, Display, TEXT("Button Right is being pressed"));
+}
diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h
index fbeb15d..0c41e49 100644
--- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h
+++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h
@@ -44,5 +44,11 @@ public:
 
 	UPROPERTY()
 	bool bisDisabled = false;
+
+	UFUNCTION(BlueprintCallable, Category= "ButtonLeft")
+	virtual void CameraLeftMover();
+
+	UFUNCTION(BlueprintCallable, Category= "ButtonLeft")
+	virtual void CameraRightMover();
 };