From b9d87ee07bcbc3b2152ad64934dacaa485a227ae Mon Sep 17 00:00:00 2001 From: MH261677 Date: Sat, 21 Jan 2023 14:19:49 +0000 Subject: [PATCH 01/31] Updated Unreal version to 5.1 --- Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset | 4 ++-- Content/Levels/MerchantPrototype.umap | 4 ++-- the_twilight_abyss.uproject | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset b/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset index cb0fa3a..f580e91 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5aba7e76546797d974d8c1fbb2f989416f27912dbd289acc8c16a5bc5b25eefd -size 70965 +oid sha256:a7a22deed0ed1e3d3a13f3e5bd3747798c9d116232832bb92aae43d321216ba7 +size 70616 diff --git a/Content/Levels/MerchantPrototype.umap b/Content/Levels/MerchantPrototype.umap index 7daa7d9..d648c7a 100644 --- a/Content/Levels/MerchantPrototype.umap +++ b/Content/Levels/MerchantPrototype.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0ffba42fc8f6527bb83238b65ee72d5d2de2589f1d1bc825c23c5d86fc732889 -size 27144 +oid sha256:ebb8b1c4142831775542c0bcb3400dc138a3360ffe820dd74cd460af4b914a53 +size 26504 diff --git a/the_twilight_abyss.uproject b/the_twilight_abyss.uproject index 4f33989..73e857f 100644 --- a/the_twilight_abyss.uproject +++ b/the_twilight_abyss.uproject @@ -1,6 +1,6 @@ { "FileVersion": 3, - "EngineAssociation": "5.0", + "EngineAssociation": "5.1", "Category": "", "Description": "", "Modules": [ From 3f4cdf5bfacd66111589a0b57b3343457d1f9e65 Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Mon, 23 Jan 2023 16:14:15 +0000 Subject: [PATCH 02/31] Updated Interaction.cpp Optimized some functions and variables by storing them in beginplay --- Content/Levels/MerchantPrototype.umap | 4 ++-- .../MerchantInteraction/Interaction.cpp | 23 ++++++++----------- .../MerchantInteraction/Interaction.h | 18 ++++++++++++--- .../PlayerTemp/TempCharacter.h | 2 ++ 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/Content/Levels/MerchantPrototype.umap b/Content/Levels/MerchantPrototype.umap index d648c7a..da545bd 100644 --- a/Content/Levels/MerchantPrototype.umap +++ b/Content/Levels/MerchantPrototype.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ebb8b1c4142831775542c0bcb3400dc138a3360ffe820dd74cd460af4b914a53 -size 26504 +oid sha256:5efb970894cb114a37a45fac46558718d0fa4bfed2b9900eebd2a752fc71d021 +size 26607 diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp index 192d23c..f8a95f4 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp @@ -22,7 +22,10 @@ AInteraction::AInteraction() void AInteraction::BeginPlay() { Super::BeginPlay(); - + TempCharacter = GetWorld()->GetFirstPlayerController()->GetCharacter(); + MainCamera = Cast(TempCharacter->FindComponentByClass()); + TargetHealingLocation = HealingItem->GetActorLocation(); + TargetBuffLocation = BuffItem->GetActorLocation(); } // Called every frame @@ -80,8 +83,6 @@ void AInteraction::RemoveWidget() void AInteraction::CameraLeftMover() { UE_LOG(LogTemp, Display, TEXT("Button Left is being pressed")); - TempCharacter = GetWorld()->GetFirstPlayerController()->GetCharacter(); - MainCamera = Cast(TempCharacter->FindComponentByClass()); if (TempCharacter == nullptr) { UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp")); @@ -90,16 +91,15 @@ void AInteraction::CameraLeftMover() else { UE_LOG(LogTemp, Display, TEXT("Character Found in interaction.cpp")); - if (MainCamera == nullptr) + if (MainCamera == nullptr || HealingItem == nullptr) { UE_LOG(LogTemp, Display, TEXT("Camera not found in Interaction.cpp")); return; } else { - FVector TargetLocation = FVector(5700,-1270,4040); - FVector CameraLocation = MainCamera->GetComponentLocation(); - FRotator CameraRotation = UKismetMathLibrary::FindLookAtRotation(CameraLocation, TargetLocation); + CameraLocation = MainCamera->GetComponentLocation(); + FRotator CameraRotation = UKismetMathLibrary::FindLookAtRotation(CameraLocation, TargetHealingLocation); MainCamera->SetWorldRotation(CameraRotation); MainCamera->SetFieldOfView(40); } @@ -109,8 +109,6 @@ void AInteraction::CameraLeftMover() void AInteraction::CameraRightMover() { UE_LOG(LogTemp, Display, TEXT("Button Right is being pressed")); - TempCharacter = GetWorld()->GetFirstPlayerController()->GetCharacter(); - MainCamera = Cast(TempCharacter->FindComponentByClass()); if (TempCharacter == nullptr) { UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp")); @@ -119,16 +117,15 @@ void AInteraction::CameraRightMover() else { UE_LOG(LogTemp, Display, TEXT("Character Found in interaction.cpp")); - if (MainCamera == nullptr) + if (MainCamera == nullptr || BuffItem == nullptr) { UE_LOG(LogTemp, Display, TEXT("Camera not found in Interaction.cpp")); return; } else { - FVector TargetLocation = FVector(5260, -840, 4070); - FVector CameraLocation = MainCamera->GetComponentLocation(); - FRotator CameraRotation = UKismetMathLibrary::FindLookAtRotation(CameraLocation, TargetLocation); + CameraLocation = MainCamera->GetComponentLocation(); + FRotator CameraRotation = UKismetMathLibrary::FindLookAtRotation(CameraLocation, TargetBuffLocation); 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 fb771a9..09e9478 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h @@ -24,10 +24,10 @@ public: // Called every frame virtual void Tick(float DeltaTime) override; - UPROPERTY(EditAnywhere) + UPROPERTY(EditAnywhere, Category= "Widgets") TSubclassOf ShopDialog; - UPROPERTY(EditAnywhere) + UPROPERTY(EditAnywhere, Category= "Widgets") TSubclassOf ItemSelector; virtual void OnInteract(); @@ -40,7 +40,7 @@ public: UPROPERTY() UUserWidget* ItemSelectorWidget; - UPROPERTY(EditAnywhere) + UPROPERTY(EditAnywhere, Category= "Widgets") float WaitTimer = 8.0f; UPROPERTY() @@ -60,5 +60,17 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Player") ACharacter* TempCharacter; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Items") + AActor* HealingItem; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Items") + AActor* BuffItem; + +private: + + FVector TargetHealingLocation; + FVector TargetBuffLocation; + FVector CameraLocation; }; diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index 052239c..51c6394 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -43,6 +43,8 @@ public: void InputDisabler(); void LineTraceLogic(); + + UPROPERTY(BlueprintReadWrite, EditAnywhere, Category= "Health") float Health; From c58d5d559248613552d0d52a0d22e443a0635fd5 Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Mon, 23 Jan 2023 17:41:30 +0000 Subject: [PATCH 03/31] Updated BP_OPENDIAL Added a custom function which gets triggered in the Interaction.cpp --- Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset | 4 ++-- .../Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset b/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset index f580e91..dc438bc 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7a22deed0ed1e3d3a13f3e5bd3747798c9d116232832bb92aae43d321216ba7 -size 70616 +oid sha256:f4e2e52de4ba0356ffd218c3f18d45903c162a857fb635aa19bd314977af161e +size 68688 diff --git a/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset b/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset index 0c71209..53b7f18 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:22b2132cd76cdc49d851a897a8295bac996dd4b048ee16722f3747a0b0a0fd42 -size 68094 +oid sha256:b4e6415a58a3ef112e7b2a99f67fe5a422f483ef40fa3bf749fea08ea1589e24 +size 67237 From ddc2ef526dedffc5eba951285ed185efd00d7a46 Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Mon, 23 Jan 2023 17:41:55 +0000 Subject: [PATCH 04/31] Updated Interaction.cpp Optimized more code by caching more widgets and instead of creating new widgets I am just toggling them on and off. --- .../MerchantInteraction/Interaction.cpp | 32 +++++++++++++++---- .../MerchantInteraction/Interaction.h | 3 ++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp index f8a95f4..89e3eef 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp @@ -22,10 +22,27 @@ AInteraction::AInteraction() void AInteraction::BeginPlay() { Super::BeginPlay(); + + //Character refs TempCharacter = GetWorld()->GetFirstPlayerController()->GetCharacter(); MainCamera = Cast(TempCharacter->FindComponentByClass()); + + //Item refs + TargetHealingLocation = HealingItem->GetActorLocation(); TargetBuffLocation = BuffItem->GetActorLocation(); + + // Dialog refs + + ShopDialogWidget = CreateWidget(GetWorld(), ShopDialog); + ShopDialogWidget->SetVisibility(ESlateVisibility::Hidden); + ShopDialogWidget->AddToViewport(); + + //Item Selector refs + ItemSelectorWidget = CreateWidget(GetWorld(), ItemSelector); + ItemSelectorWidget->SetVisibility(ESlateVisibility::Hidden); + ItemSelectorWidget->AddToViewport(); + Property = ItemSelectorWidget->GetClass()->FindPropertyByName("publicActor"); } // Called every frame @@ -38,14 +55,17 @@ void AInteraction::Tick(float DeltaTime) void AInteraction::OnInteract() { bDisableShopDialMove = true; - ShopDialogWidget = CreateWidget(GetWorld(), ShopDialog); if (ShopDialogWidget == nullptr) { + UE_LOG(LogTemp, Display, TEXT("ShopDialogWidget is null")); return; } else { - ShopDialogWidget->AddToViewport(0); + //Shop Widget to visible + ShopDialogWidget->SetVisibility(ESlateVisibility::Visible); + //Call a custom event in a blueprint called "PlayText" + ShopDialogWidget->CallFunctionByNameWithArguments(TEXT("PlayText"), *GLog, nullptr, true); } //handles the widget disappearing from the viewport FTimerHandle WidgetTimer; @@ -56,10 +76,10 @@ void AInteraction::OnInteract() void AInteraction::RemoveWidget() { bisDisabled = true; - ShopDialogWidget->RemoveFromViewport(); + //Setting ShopWidgetText back to hidden + ShopDialogWidget->SetVisibility(ESlateVisibility::Hidden); UE_LOG(LogTemp, Display, TEXT("setting isDisabled to true")); - ItemSelectorWidget = CreateWidget(GetWorld(), ItemSelector); - FProperty* Property = ItemSelectorWidget->GetClass()->FindPropertyByName("publicActor"); + if (Property == nullptr) { UE_LOG(LogTemp, Error, TEXT("Property not found")); @@ -75,7 +95,7 @@ void AInteraction::RemoveWidget() } else { - ItemSelectorWidget->AddToViewport(0); + ItemSelectorWidget->SetVisibility(ESlateVisibility::Visible); bisDisabled = false; } } diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h index 09e9478..8b9e5a7 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h @@ -66,11 +66,14 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Items") AActor* BuffItem; + private: FVector TargetHealingLocation; FVector TargetBuffLocation; FVector CameraLocation; + + FProperty* Property; }; From 2f22ec811f893d4e405dd6d1c2ac62726ce84be0 Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Thu, 26 Jan 2023 17:41:51 +0000 Subject: [PATCH 05/31] Updated Merchant_UI Removed things being removed from parent and transferred it from code to fix many bugs, Also fixed text being instantly displayed once you talk to the merchant again --- Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset | 4 ++-- .../Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset | 4 ++-- Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset | 4 ++-- Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset | 4 ++-- Content/Levels/MerchantPrototype.umap | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset b/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset index dc438bc..239df23 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f4e2e52de4ba0356ffd218c3f18d45903c162a857fb635aa19bd314977af161e -size 68688 +oid sha256:dd57bdf81793aa6f3b76784e3be306fef5ca81c5e2fa7065a29abadd420c4e0b +size 75420 diff --git a/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset b/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset index 53b7f18..f4f9818 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b4e6415a58a3ef112e7b2a99f67fe5a422f483ef40fa3bf749fea08ea1589e24 -size 67237 +oid sha256:42aa0e6d25904de056d4d64509aa7c804155c5b3a212ada658ca10dcb63f3e32 +size 55403 diff --git a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset index 3d3b44f..7eecebb 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8cc4e9151595d71a12c6f44c47b8f62ebb2687944cc124a6927fb8cddcf6a1fc -size 51431 +oid sha256:abe53946825159c2220acd237c3cc7360478b63836d52e3cbe000876e43eb5d5 +size 63822 diff --git a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset index 5420305..8e7650a 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f15b92c944a3038b636058b7f8fb3a6573a2ec271c3a6a1670bb5b9541c9d7c -size 52018 +oid sha256:936f77df55a4f4c1baca361f8ca9384f1af821ab6c0e8c9b016a3ede25c9f8d1 +size 63821 diff --git a/Content/Levels/MerchantPrototype.umap b/Content/Levels/MerchantPrototype.umap index da545bd..ea85903 100644 --- a/Content/Levels/MerchantPrototype.umap +++ b/Content/Levels/MerchantPrototype.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5efb970894cb114a37a45fac46558718d0fa4bfed2b9900eebd2a752fc71d021 -size 26607 +oid sha256:838c48c134383d4b1db178233640e11ef2c4bcd49102f53648cf621dd1dcbf8a +size 27100 From 6faa177f962175d15c851fc27e05f03f3a85dbbd Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Thu, 26 Jan 2023 17:43:07 +0000 Subject: [PATCH 06/31] Updated Interaction.cpp Referenced the two buy confirms screen so I can just hide them and cache them upon the start of the game to optimize and fix many bugs such as being able to stack the buy screens. --- .../MerchantInteraction/Interaction.cpp | 46 ++++++++++++++++++- .../MerchantInteraction/Interaction.h | 22 +++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp index 89e3eef..a029e95 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp @@ -42,7 +42,21 @@ void AInteraction::BeginPlay() ItemSelectorWidget = CreateWidget(GetWorld(), ItemSelector); ItemSelectorWidget->SetVisibility(ESlateVisibility::Hidden); ItemSelectorWidget->AddToViewport(); + //We are getting the property of interaction since we need a reference for when we cast in BP and we need the reference to be self Property = ItemSelectorWidget->GetClass()->FindPropertyByName("publicActor"); + + //Confirm Buy refs + BuyBuffTextWidget = CreateWidget(GetWorld(), BuyBuffText); + BuyBuffTextWidget->SetVisibility(ESlateVisibility::Hidden); + BuyBuffTextWidget->AddToViewport(); + //We are getting the property of interaction since we need a reference for when we cast in BP and we need the reference to be self + BuyBuffProperty = BuyBuffTextWidget->GetClass()->FindPropertyByName("publicActor"); + + BuyHealingTextWidget = CreateWidget(GetWorld(), BuyHealingText); + BuyHealingTextWidget->SetVisibility(ESlateVisibility::Hidden); + BuyHealingTextWidget->AddToViewport(); + //We are getting the property of interaction since we need a reference for when we cast in BP and we need the reference to be self + BuyHealingProperty = BuyHealingTextWidget->GetClass()->FindPropertyByName("publicActor"); } // Called every frame @@ -83,6 +97,7 @@ void AInteraction::RemoveWidget() if (Property == nullptr) { UE_LOG(LogTemp, Error, TEXT("Property not found")); + return; } else { @@ -103,7 +118,7 @@ void AInteraction::RemoveWidget() void AInteraction::CameraLeftMover() { UE_LOG(LogTemp, Display, TEXT("Button Left is being pressed")); - if (TempCharacter == nullptr) + if (TempCharacter == nullptr || BuyHealingProperty == nullptr) { UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp")); return; @@ -118,10 +133,14 @@ void AInteraction::CameraLeftMover() } else { + FObjectPropertyBase* ObjectProperty = static_cast(BuyHealingProperty); + ObjectProperty->SetObjectPropertyValue(ObjectProperty->ContainerPtrToValuePtr(BuyHealingTextWidget), this); + CameraLocation = MainCamera->GetComponentLocation(); FRotator CameraRotation = UKismetMathLibrary::FindLookAtRotation(CameraLocation, TargetHealingLocation); MainCamera->SetWorldRotation(CameraRotation); MainCamera->SetFieldOfView(40); + BuyHealingTextWidget->SetVisibility(ESlateVisibility::Visible); } } } @@ -129,7 +148,7 @@ void AInteraction::CameraLeftMover() void AInteraction::CameraRightMover() { UE_LOG(LogTemp, Display, TEXT("Button Right is being pressed")); - if (TempCharacter == nullptr) + if (TempCharacter == nullptr || BuyBuffProperty == nullptr) { UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp")); return; @@ -144,10 +163,33 @@ void AInteraction::CameraRightMover() } else { + FObjectPropertyBase* ObjectProperty = static_cast(BuyBuffProperty); + ObjectProperty->SetObjectPropertyValue(ObjectProperty->ContainerPtrToValuePtr(BuyBuffTextWidget), this); + CameraLocation = MainCamera->GetComponentLocation(); FRotator CameraRotation = UKismetMathLibrary::FindLookAtRotation(CameraLocation, TargetBuffLocation); MainCamera->SetWorldRotation(CameraRotation); MainCamera->SetFieldOfView(40); + BuyBuffTextWidget->SetVisibility(ESlateVisibility::Visible); } } } + +void AInteraction::CancelPurchase() +{ + BuyBuffTextWidget->SetVisibility(ESlateVisibility::Hidden); + BuyHealingTextWidget->SetVisibility(ESlateVisibility::Hidden); +} + +void AInteraction::HealingPurchase() +{ + +} + +void AInteraction::BuffPurchase() +{ + +} + + + diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h index 8b9e5a7..72b0afb 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h @@ -30,6 +30,12 @@ public: UPROPERTY(EditAnywhere, Category= "Widgets") TSubclassOf ItemSelector; + UPROPERTY(EditAnywhere, Category = "Widgets") + TSubclassOf BuyBuffText; + + UPROPERTY(EditAnywhere, Category = "Widgets") + TSubclassOf BuyHealingText; + virtual void OnInteract(); virtual void RemoveWidget(); @@ -39,6 +45,12 @@ public: UPROPERTY() UUserWidget* ItemSelectorWidget; + + UPROPERTY() + UUserWidget* BuyBuffTextWidget; + + UPROPERTY() + UUserWidget* BuyHealingTextWidget; UPROPERTY(EditAnywhere, Category= "Widgets") float WaitTimer = 8.0f; @@ -67,6 +79,14 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Items") AActor* BuffItem; + UFUNCTION(BlueprintCallable, Category = "ConfirmButtons") + virtual void CancelPurchase(); + + UFUNCTION(BlueprintCallable, Category = "ConfirmButtons") + virtual void HealingPurchase(); + + UFUNCTION(BlueprintCallable, Category = "ConfirmButtons") + virtual void BuffPurchase(); private: @@ -75,5 +95,7 @@ private: FVector CameraLocation; FProperty* Property; + FProperty* BuyBuffProperty; + FProperty* BuyHealingProperty; }; From ecae96081dc12fb9728c3104507ba8e617daa20d Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Thu, 26 Jan 2023 17:54:56 +0000 Subject: [PATCH 07/31] Added Geometry Collection for Destructable Components --- Content/Levels/Testing/CopyStalagite.uasset | 3 +++ Content/Levels/Testing/DestructableEnvironment.umap | 3 +++ Content/Levels/Testing/Stalagite_GeometryCollection.uasset | 3 +++ Content/Levels/Top_layer_level.umap | 4 ++-- the_twilight_abyss.uproject | 4 ++++ 5 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 Content/Levels/Testing/CopyStalagite.uasset create mode 100644 Content/Levels/Testing/DestructableEnvironment.umap create mode 100644 Content/Levels/Testing/Stalagite_GeometryCollection.uasset diff --git a/Content/Levels/Testing/CopyStalagite.uasset b/Content/Levels/Testing/CopyStalagite.uasset new file mode 100644 index 0000000..b431889 --- /dev/null +++ b/Content/Levels/Testing/CopyStalagite.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db92152f858900ca683a3802711017f8096bfa3fa3cb4927ab66e1aab4da448b +size 1342607 diff --git a/Content/Levels/Testing/DestructableEnvironment.umap b/Content/Levels/Testing/DestructableEnvironment.umap new file mode 100644 index 0000000..7ec9da9 --- /dev/null +++ b/Content/Levels/Testing/DestructableEnvironment.umap @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f06da83cd4d0159f28d9f56a2b3adfcefac21f62021d145a7a112422b75326c +size 38502 diff --git a/Content/Levels/Testing/Stalagite_GeometryCollection.uasset b/Content/Levels/Testing/Stalagite_GeometryCollection.uasset new file mode 100644 index 0000000..681a240 --- /dev/null +++ b/Content/Levels/Testing/Stalagite_GeometryCollection.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e82c52e382833121ae4732dc3d9e99795b251a33ded6f5c8cf9590d46968bd98 +size 52222503 diff --git a/Content/Levels/Top_layer_level.umap b/Content/Levels/Top_layer_level.umap index d049a89..1517b01 100644 --- a/Content/Levels/Top_layer_level.umap +++ b/Content/Levels/Top_layer_level.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d2dd8366d387522e449ec22291f4ce25c052cc302effa136cd7418dfde5f361e -size 217743 +oid sha256:a4c3d9a7f84050a825d8d4c34139d5af6df268aa9765795bc651731bc4c4ca50 +size 219357 diff --git a/the_twilight_abyss.uproject b/the_twilight_abyss.uproject index 73e857f..5d45481 100644 --- a/the_twilight_abyss.uproject +++ b/the_twilight_abyss.uproject @@ -30,6 +30,10 @@ "Mac", "Linux" ] + }, + { + "Name": "ApexDestruction", + "Enabled": true } ], "TargetPlatforms": [ From 810b4b1680dc024a1a56861eafa792b7ad3a5ecf Mon Sep 17 00:00:00 2001 From: MARCEL HARA Date: Thu, 26 Jan 2023 18:12:24 +0000 Subject: [PATCH 08/31] TemporarilyBroken TempCharacter.cpp Attempted to fix the close button currently it crashes. --- Content/Blueprints/Combat_UI/CombatCharacter.uasset | 4 ++-- .../Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset | 4 ++-- Content/Blueprints/Player/BP_MyTempCharacter.uasset | 4 ++-- Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp | 2 +- Source/the_twilight_abyss/PlayerTemp/TempCharacter.h | 6 ++++++ 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Content/Blueprints/Combat_UI/CombatCharacter.uasset b/Content/Blueprints/Combat_UI/CombatCharacter.uasset index 95ef963..af30af7 100644 --- a/Content/Blueprints/Combat_UI/CombatCharacter.uasset +++ b/Content/Blueprints/Combat_UI/CombatCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:465dda65f6f573e5b213f73e85bf00219e3bbcc762d215532bb138add6695028 -size 82954 +oid sha256:fe3a4ab394636a9f640bfd6b48f1124b36aa73681728412f0aa58ad4d604cb8e +size 79935 diff --git a/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset b/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset index f4f9818..3659a77 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:42aa0e6d25904de056d4d64509aa7c804155c5b3a212ada658ca10dcb63f3e32 -size 55403 +oid sha256:1e9ac1ff7478dfef5edd2254f1241a9b10b7b79d228f1c7fa962c0579a7b2183 +size 53418 diff --git a/Content/Blueprints/Player/BP_MyTempCharacter.uasset b/Content/Blueprints/Player/BP_MyTempCharacter.uasset index 3cd68ed..a5cecf1 100644 --- a/Content/Blueprints/Player/BP_MyTempCharacter.uasset +++ b/Content/Blueprints/Player/BP_MyTempCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:48787fb18ad9d51b32e5b837c8c1605b11d1b60014c75f2efa1ab910d621415b -size 56881 +oid sha256:443a43ffede70052c0fb3aa89ba6b5ed76bbe89ac6526cead6d574165d0e1c36 +size 54865 diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index 50029de..da1d08c 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -161,7 +161,7 @@ void ATempCharacter::InputEnabler() ThisCamera->SetWorldLocation(OriginalCameraLocation); ThisCamera->SetWorldRotation(OriginalCameraRotation); ThisCamera->FieldOfView = OriginalCameraFOV; - + ItemSelectorWidget->SetVisibility(ESlateVisibility::Hidden); //ulog the originalcameralocation value UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString()); } diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index 51c6394..5333280 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -32,6 +32,12 @@ public: UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Inventory, meta = (AllowPrivateAccess = "true")) class UInventoryComponent* Inventory; //Using the InventoryComponent class + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ItemSelector") + UUserWidget* ItemSelectorWidget; + + UPROPERTY(EditAnywhere, Category = "Widgets") + TSubclassOf ItemSelector; + // Called to bind functionality to input virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; From 414e820a3e9d5bff0a8a043630f7f302225b86a2 Mon Sep 17 00:00:00 2001 From: Blue Probert Date: Mon, 30 Jan 2023 15:46:31 +0000 Subject: [PATCH 09/31] Combat Google Doc link Added a link to the Combat Google Doc to the additional resources text fil in the misc folder. --- Misc/Additional Resources/Links To Additional Resources.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Misc/Additional Resources/Links To Additional Resources.txt b/Misc/Additional Resources/Links To Additional Resources.txt index 1101c45..e79ccf7 100644 --- a/Misc/Additional Resources/Links To Additional Resources.txt +++ b/Misc/Additional Resources/Links To Additional Resources.txt @@ -1,4 +1,6 @@ Combat Spread Sheet: -https://docs.google.com/spreadsheets/d/1s_uxjS8ir1pbt4-ofdOVpSPaQZVC8x9gQzS78bzE3KI/edit#gid=0 \ No newline at end of file +https://docs.google.com/spreadsheets/d/1s_uxjS8ir1pbt4-ofdOVpSPaQZVC8x9gQzS78bzE3KI/edit#gid=0 +https://docs.google.com/document/d/1Y6eYoKQPw9n8gl7p030fmtPjfJcE132YHAvwL7Gk4jk/edit + From d658c636276c1545698bc96c877fe5af9a4bbebd Mon Sep 17 00:00:00 2001 From: Marcel Hara Date: Mon, 30 Jan 2023 17:20:22 +0000 Subject: [PATCH 10/31] Updated WBP_ShopSelector Got rid of it casting from tempcharacter but instead it casts from interaction which then activates a function in interaction which activates a different function in tempcharacter --- Content/Blueprints/Combat_UI/CombatCharacter.uasset | 4 ++-- .../Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset | 4 ++-- Content/Blueprints/Player/BP_MyTempCharacter.uasset | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Content/Blueprints/Combat_UI/CombatCharacter.uasset b/Content/Blueprints/Combat_UI/CombatCharacter.uasset index af30af7..840bc9a 100644 --- a/Content/Blueprints/Combat_UI/CombatCharacter.uasset +++ b/Content/Blueprints/Combat_UI/CombatCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fe3a4ab394636a9f640bfd6b48f1124b36aa73681728412f0aa58ad4d604cb8e -size 79935 +oid sha256:39f35733eb5d9cd8382249210d2fd0ac1c18511e9202db00a69a5fe8d0c9ce36 +size 79155 diff --git a/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset b/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset index 3659a77..0c1f862 100644 --- a/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset +++ b/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1e9ac1ff7478dfef5edd2254f1241a9b10b7b79d228f1c7fa962c0579a7b2183 -size 53418 +oid sha256:0fe126443f981aa1875e8efe299d76c4f0f570aff93f9313cc9503bb811365a5 +size 51324 diff --git a/Content/Blueprints/Player/BP_MyTempCharacter.uasset b/Content/Blueprints/Player/BP_MyTempCharacter.uasset index a5cecf1..f1f038b 100644 --- a/Content/Blueprints/Player/BP_MyTempCharacter.uasset +++ b/Content/Blueprints/Player/BP_MyTempCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:443a43ffede70052c0fb3aa89ba6b5ed76bbe89ac6526cead6d574165d0e1c36 -size 54865 +oid sha256:be58819ba52b5638a31c272d4b3d2b93cfd6c75d2ad1717183b971c1c9d78234 +size 54639 From 11e6393726c461ec605526efd817512972024fa2 Mon Sep 17 00:00:00 2001 From: Marcel Hara Date: Mon, 30 Jan 2023 17:21:10 +0000 Subject: [PATCH 11/31] Updated Interaction,TempCharacter.cpp Removed the code from TempCharacter from last commit and created a new function Inside of Interaction that activates the TempCharacter.cpp InputEnabler() --- .../MerchantInteraction/Interaction.cpp | 30 +++++++++++-------- .../MerchantInteraction/Interaction.h | 12 ++++---- .../PlayerTemp/TempCharacter.cpp | 1 - .../PlayerTemp/TempCharacter.h | 7 ++--- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp index a029e95..cfd111a 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp @@ -9,6 +9,7 @@ #include "GameFramework/Character.h" #include "Components/WidgetComponent.h" #include "Kismet/KismetMathLibrary.h" +#include "the_twilight_abyss/PlayerTemp/TempCharacter.h" // Sets default values @@ -24,9 +25,8 @@ void AInteraction::BeginPlay() Super::BeginPlay(); //Character refs - TempCharacter = GetWorld()->GetFirstPlayerController()->GetCharacter(); - MainCamera = Cast(TempCharacter->FindComponentByClass()); - + TempCharacterRef = Cast(GetWorld()->GetFirstPlayerController()->GetCharacter()); + MainCamera = Cast(TempCharacterRef->FindComponentByClass()); //Item refs TargetHealingLocation = HealingItem->GetActorLocation(); @@ -57,6 +57,7 @@ void AInteraction::BeginPlay() BuyHealingTextWidget->AddToViewport(); //We are getting the property of interaction since we need a reference for when we cast in BP and we need the reference to be self BuyHealingProperty = BuyHealingTextWidget->GetClass()->FindPropertyByName("publicActor"); + } // Called every frame @@ -118,7 +119,7 @@ void AInteraction::RemoveWidget() void AInteraction::CameraLeftMover() { UE_LOG(LogTemp, Display, TEXT("Button Left is being pressed")); - if (TempCharacter == nullptr || BuyHealingProperty == nullptr) + if (TempCharacterRef == nullptr || BuyHealingProperty == nullptr) { UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp")); return; @@ -148,7 +149,7 @@ void AInteraction::CameraLeftMover() void AInteraction::CameraRightMover() { UE_LOG(LogTemp, Display, TEXT("Button Right is being pressed")); - if (TempCharacter == nullptr || BuyBuffProperty == nullptr) + if (TempCharacterRef == nullptr || BuyBuffProperty == nullptr) { UE_LOG(LogTemp, Display, TEXT("Character not found in Interaction.cpp")); return; @@ -181,15 +182,20 @@ void AInteraction::CancelPurchase() BuyHealingTextWidget->SetVisibility(ESlateVisibility::Hidden); } -void AInteraction::HealingPurchase() +void AInteraction::ExitScreen() { - -} - -void AInteraction::BuffPurchase() -{ - + if (TempCharacterRef == nullptr) + { + UE_LOG(LogTemp, Display, TEXT("TempCharacterRef in Interaction.cpp not found")); + return; + } + else + { + TempCharacterRef->InputEnabler(); + ItemSelectorWidget->SetVisibility(ESlateVisibility::Hidden); + } } + diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h index 72b0afb..798c680 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h @@ -5,6 +5,7 @@ #include "CoreMinimal.h" #include "Camera/CameraComponent.h" #include "GameFramework/Actor.h" +#include "the_twilight_abyss/PlayerTemp/TempCharacter.h" #include "Interaction.generated.h" UCLASS() @@ -70,9 +71,6 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera") UCameraComponent* MainCamera; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Player") - ACharacter* TempCharacter; - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Items") AActor* HealingItem; @@ -83,10 +81,10 @@ public: virtual void CancelPurchase(); UFUNCTION(BlueprintCallable, Category = "ConfirmButtons") - virtual void HealingPurchase(); - - UFUNCTION(BlueprintCallable, Category = "ConfirmButtons") - virtual void BuffPurchase(); + virtual void ExitScreen(); + + UPROPERTY(EditAnywhere, Category = "Player") + ATempCharacter* TempCharacterRef; private: diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index da1d08c..d646157 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -161,7 +161,6 @@ void ATempCharacter::InputEnabler() ThisCamera->SetWorldLocation(OriginalCameraLocation); ThisCamera->SetWorldRotation(OriginalCameraRotation); ThisCamera->FieldOfView = OriginalCameraFOV; - ItemSelectorWidget->SetVisibility(ESlateVisibility::Hidden); //ulog the originalcameralocation value UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString()); } diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index 5333280..9bb3b3f 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -31,12 +31,9 @@ public: UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Inventory, meta = (AllowPrivateAccess = "true")) class UInventoryComponent* Inventory; //Using the InventoryComponent class - - UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ItemSelector") + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Widgets") UUserWidget* ItemSelectorWidget; - - UPROPERTY(EditAnywhere, Category = "Widgets") - TSubclassOf ItemSelector; // Called to bind functionality to input virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; From 63e44f47e8aae8f232928aeea9bccca302d473cc Mon Sep 17 00:00:00 2001 From: Marcel Hara Date: Mon, 30 Jan 2023 17:23:19 +0000 Subject: [PATCH 12/31] Changed Interaction.cpp comment change Changed the ref comment --- Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp index cfd111a..f8589fd 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp @@ -24,7 +24,7 @@ void AInteraction::BeginPlay() { Super::BeginPlay(); - //Character refs + //Character & Camera refs TempCharacterRef = Cast(GetWorld()->GetFirstPlayerController()->GetCharacter()); MainCamera = Cast(TempCharacterRef->FindComponentByClass()); //Item refs From 883567b25091aa64a979fd8c131763bfda02a5a1 Mon Sep 17 00:00:00 2001 From: KACPER SZELEST Date: Mon, 30 Jan 2023 17:36:13 +0000 Subject: [PATCH 13/31] Update readme.md --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index f091f16..e688752 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,5 @@ # The Twilight Abyss ## By Team 2:13 + +https://docs.google.com/spreadsheets/d/13iVCQuveBiaihpREnY145OZi5QT-1sseNoI0A5v8D1o/edit?usp=sharing From f33c43689bf905bc720fb4342e34efc2d5b5f434 Mon Sep 17 00:00:00 2001 From: MH261677 Date: Mon, 30 Jan 2023 21:07:36 +0000 Subject: [PATCH 14/31] Updated Interaction,TempCharacter.cpp Fixed being able to open the text widget while the selector is open so merchant is fully working now. --- .../MerchantInteraction/Interaction.cpp | 8 ++++ .../MerchantInteraction/Interaction.h | 1 + .../PlayerTemp/TempCharacter.cpp | 39 ++++++++++++++----- .../PlayerTemp/TempCharacter.h | 2 + 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp index f8589fd..beaad39 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.cpp @@ -93,6 +93,14 @@ void AInteraction::RemoveWidget() bisDisabled = true; //Setting ShopWidgetText back to hidden ShopDialogWidget->SetVisibility(ESlateVisibility::Hidden); + if (ShopDialogWidget->IsVisible()) + { + return; + } + else + { + UE_LOG(LogTemp, Display, TEXT("You cant open this widget when this widget is open")); + } UE_LOG(LogTemp, Display, TEXT("setting isDisabled to true")); if (Property == nullptr) diff --git a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h index 798c680..76af4db 100644 --- a/Source/the_twilight_abyss/MerchantInteraction/Interaction.h +++ b/Source/the_twilight_abyss/MerchantInteraction/Interaction.h @@ -61,6 +61,7 @@ public: UPROPERTY() bool bDisableShopDialMove = false; + UFUNCTION(BlueprintCallable, Category= "ButtonLeft") virtual void CameraLeftMover(); diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index d646157..bfdfe06 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -101,18 +101,35 @@ void ATempCharacter::LineTraceLogic() if (AInteraction* MyInteractable = Cast(OutHit.GetActor())) { - DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 1.0f); - MyInteractable->OnInteract(); - UE_LOG(LogTemp, Display, TEXT("OnInteract activated")); - UE_LOG(LogTemp, Display, TEXT("HIT: %s"), *OutHit.GetActor()->GetName()); - - // While loop to check bisDisabled var until it changes to true - while (MyInteractable->bisDisabled == false || MyInteractable->bDisableShopDialMove == false) + if (MyInteractable->ShopDialogWidget->IsVisible()) { - if (MyInteractable->bisDisabled == true || MyInteractable->bDisableShopDialMove == true) + UE_LOG(LogTemp, Display, TEXT("ShopKeeper text is visible")); + bShopKeeperText = true; + return; + } + //if there is no text on screen this triggers + else + { + if (MyInteractable->ItemSelectorWidget->IsVisible()) { - InputDisabler(); - break; + return; + } + else + { + DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 1.0f); + MyInteractable->OnInteract(); + UE_LOG(LogTemp, Display, TEXT("OnInteract activated")); + UE_LOG(LogTemp, Display, TEXT("HIT: %s"), *OutHit.GetActor()->GetName()); + + // While loop to check bisDisabled var until it changes to true + while (MyInteractable->bisDisabled == false || MyInteractable->bDisableShopDialMove == false) + { + if (MyInteractable->bisDisabled == true || MyInteractable->bDisableShopDialMove == true) + { + InputDisabler(); + break; + } + } } } } @@ -122,6 +139,7 @@ void ATempCharacter::LineTraceLogic() void ATempCharacter::InputDisabler() { UE_LOG(LogTemp, Display, TEXT("Disabling playermovement")); + //GetWorld()->GetFirstPlayerController()->InputComponent->RemoveActionBinding("Interact", IE_Pressed); GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(true); GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(true); GetWorld()->GetFirstPlayerController()->bShowMouseCursor = true; @@ -150,6 +168,7 @@ void ATempCharacter::InputEnabler() GetWorld()->GetFirstPlayerController()->bShowMouseCursor = false; GetWorld()->GetFirstPlayerController()->bEnableClickEvents = false; GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = false; + //GetWorld()->GetFirstPlayerController()->InputComponent->BindAction("Interact", IE_Pressed, this, &ATempCharacter::KeyPressed); TraceDistance = 300; ThisCamera = Cast(this->FindComponentByClass()); if (ThisCamera == nullptr) diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index 9bb3b3f..928b8df 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -75,5 +75,7 @@ public: UFUNCTION(BlueprintCallable, Category= "Items") void BuyItem(); + + bool bShopKeeperText = false; }; From f4134c478f35b8c161dc59180d5420924dc057fb Mon Sep 17 00:00:00 2001 From: KACPER Szelest Date: Mon, 30 Jan 2023 22:37:15 +0000 Subject: [PATCH 15/31] Added Blue Jelly asset I added a blue jelly asset to be used in the merchant system --- Content/Assets/Objects/Blue_Jelly/BlueJelly_Cylinder.uasset | 3 +++ Content/Assets/Objects/Blue_Jelly/BlueJelly_Mball_009.uasset | 3 +++ Content/Assets/Objects/Blue_Jelly/Material_001.uasset | 3 +++ Content/Assets/Objects/Blue_Jelly/Material_002.uasset | 3 +++ 4 files changed, 12 insertions(+) create mode 100644 Content/Assets/Objects/Blue_Jelly/BlueJelly_Cylinder.uasset create mode 100644 Content/Assets/Objects/Blue_Jelly/BlueJelly_Mball_009.uasset create mode 100644 Content/Assets/Objects/Blue_Jelly/Material_001.uasset create mode 100644 Content/Assets/Objects/Blue_Jelly/Material_002.uasset diff --git a/Content/Assets/Objects/Blue_Jelly/BlueJelly_Cylinder.uasset b/Content/Assets/Objects/Blue_Jelly/BlueJelly_Cylinder.uasset new file mode 100644 index 0000000..8aec2fd --- /dev/null +++ b/Content/Assets/Objects/Blue_Jelly/BlueJelly_Cylinder.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca8b57cfbdcd8348470e39d8c28aa3f2cb3e0da6e81be5750c7e8bced379045c +size 39551 diff --git a/Content/Assets/Objects/Blue_Jelly/BlueJelly_Mball_009.uasset b/Content/Assets/Objects/Blue_Jelly/BlueJelly_Mball_009.uasset new file mode 100644 index 0000000..8d6a890 --- /dev/null +++ b/Content/Assets/Objects/Blue_Jelly/BlueJelly_Mball_009.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b34cad3ae6933b9958c0366df60f26ed8861b6c7faf8926f77eb9d77c57a14e3 +size 102108 diff --git a/Content/Assets/Objects/Blue_Jelly/Material_001.uasset b/Content/Assets/Objects/Blue_Jelly/Material_001.uasset new file mode 100644 index 0000000..a6f03fa --- /dev/null +++ b/Content/Assets/Objects/Blue_Jelly/Material_001.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4cfaa4f57bf66b81bb79bc771e9dc4a12e839f7013713c576f2cc0f0d6fec17b +size 7982 diff --git a/Content/Assets/Objects/Blue_Jelly/Material_002.uasset b/Content/Assets/Objects/Blue_Jelly/Material_002.uasset new file mode 100644 index 0000000..b63b60b --- /dev/null +++ b/Content/Assets/Objects/Blue_Jelly/Material_002.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4a7c513681ca7acfa66d54e22e631b06471bacf059d31e2b0c4df2f2ee1c87a +size 7553 From beb110a90153cf3b2b8c8071ff661a528b0fd95a Mon Sep 17 00:00:00 2001 From: KACPER Szelest Date: Mon, 30 Jan 2023 22:39:29 +0000 Subject: [PATCH 16/31] Added Red Jelly Asset I added a red Jelly asset to be used in the merchant system as a placeholder asset --- Content/Assets/Objects/Red_Jelly/Material_001.uasset | 3 +++ Content/Assets/Objects/Red_Jelly/Material_002.uasset | 3 +++ Content/Assets/Objects/Red_Jelly/Redjelly_Cylinder.uasset | 3 +++ Content/Assets/Objects/Red_Jelly/Redjelly_Mball_009.uasset | 3 +++ 4 files changed, 12 insertions(+) create mode 100644 Content/Assets/Objects/Red_Jelly/Material_001.uasset create mode 100644 Content/Assets/Objects/Red_Jelly/Material_002.uasset create mode 100644 Content/Assets/Objects/Red_Jelly/Redjelly_Cylinder.uasset create mode 100644 Content/Assets/Objects/Red_Jelly/Redjelly_Mball_009.uasset diff --git a/Content/Assets/Objects/Red_Jelly/Material_001.uasset b/Content/Assets/Objects/Red_Jelly/Material_001.uasset new file mode 100644 index 0000000..19cf8df --- /dev/null +++ b/Content/Assets/Objects/Red_Jelly/Material_001.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed9efc59130655d42cf557ef3026512a72c7582dfd28e4088cb8e899e6ca8572 +size 7326 diff --git a/Content/Assets/Objects/Red_Jelly/Material_002.uasset b/Content/Assets/Objects/Red_Jelly/Material_002.uasset new file mode 100644 index 0000000..374de08 --- /dev/null +++ b/Content/Assets/Objects/Red_Jelly/Material_002.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b712614cebd3c1cc786fd40866cf4c47657e7cd3e7e74fb154c9e83032fb6ab +size 7580 diff --git a/Content/Assets/Objects/Red_Jelly/Redjelly_Cylinder.uasset b/Content/Assets/Objects/Red_Jelly/Redjelly_Cylinder.uasset new file mode 100644 index 0000000..78e71c9 --- /dev/null +++ b/Content/Assets/Objects/Red_Jelly/Redjelly_Cylinder.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aeaf5f844d2499c0f9376361f8205bb1851deec49e37bbbe9fde8827a2a14321 +size 39558 diff --git a/Content/Assets/Objects/Red_Jelly/Redjelly_Mball_009.uasset b/Content/Assets/Objects/Red_Jelly/Redjelly_Mball_009.uasset new file mode 100644 index 0000000..203fb89 --- /dev/null +++ b/Content/Assets/Objects/Red_Jelly/Redjelly_Mball_009.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9cbd3275bdc85e115cd900d3d96dde3ef29b41ef8030dccb0fae2f18c531a933 +size 102016 From cd17363421925eaaa9af01c2c76ab04dd3d51358 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Mon, 30 Jan 2023 23:03:20 +0000 Subject: [PATCH 17/31] Removed Legacy Source Code to Reduce Compilation --- Content/Levels/CombatTest.umap | 3 - Content/Levels/RealTimeCombatSystemTest.umap | 3 - .../RealTimeCombat/RealTimeCombat.cpp | 319 ------------------ .../RealTimeCombat/RealTimeCombat.h | 127 ------- .../PlayerCharacterCombatTest.cpp | 35 -- .../PlayerCharacterCombatTest.h | 29 -- .../TurnBasedCombat/TurnBaseCombat.cpp | 297 ---------------- .../TurnBasedCombat/TurnBaseCombat.h | 145 -------- 8 files changed, 958 deletions(-) delete mode 100644 Content/Levels/CombatTest.umap delete mode 100644 Content/Levels/RealTimeCombatSystemTest.umap delete mode 100644 Source/the_twilight_abyss/RealTimeCombat/RealTimeCombat.cpp delete mode 100644 Source/the_twilight_abyss/RealTimeCombat/RealTimeCombat.h delete mode 100644 Source/the_twilight_abyss/TurnBasedCombat/PlayerCharacterCombatTest.cpp delete mode 100644 Source/the_twilight_abyss/TurnBasedCombat/PlayerCharacterCombatTest.h delete mode 100644 Source/the_twilight_abyss/TurnBasedCombat/TurnBaseCombat.cpp delete mode 100644 Source/the_twilight_abyss/TurnBasedCombat/TurnBaseCombat.h diff --git a/Content/Levels/CombatTest.umap b/Content/Levels/CombatTest.umap deleted file mode 100644 index a1a8b59..0000000 --- a/Content/Levels/CombatTest.umap +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f9336348b2e1f84fb09314f0877836bec1973c977e1368b37276d5ab3db5344f -size 36124 diff --git a/Content/Levels/RealTimeCombatSystemTest.umap b/Content/Levels/RealTimeCombatSystemTest.umap deleted file mode 100644 index 9535012..0000000 --- a/Content/Levels/RealTimeCombatSystemTest.umap +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6fdfa02987672d19d3e4258aa21b585b6756ac110117681237b05928a3ae2891 -size 78727 diff --git a/Source/the_twilight_abyss/RealTimeCombat/RealTimeCombat.cpp b/Source/the_twilight_abyss/RealTimeCombat/RealTimeCombat.cpp deleted file mode 100644 index 4242df1..0000000 --- a/Source/the_twilight_abyss/RealTimeCombat/RealTimeCombat.cpp +++ /dev/null @@ -1,319 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - - -#include "RealTimeCombat.h" -#include "CoreMinimal.h" -#include "Blueprint/UserWidget.h" -#include "Components/TextBlock.h" -#include "Components/ProgressBar.h" -#include "Kismet/GameplayStatics.h" - - -ARealTimeCombat::ARealTimeCombat() -{ - PrimaryActorTick.bCanEverTick = true; - if (HUDWidget == nullptr) - { - // Load the HUD widget from the specified path - static ConstructorHelpers::FClassFinder HUDWidgetClass(TEXT("/Game/Blueprints/Combat_UI/Combat_UI_RT")); - HUDWidget = HUDWidgetClass.Class; - } -} - -void ARealTimeCombat::StartCombat() -{ - if (HUD->IsInViewport()) return; - HUD->AddToViewport(); - bStartTimer = true; - //EnemyActor = Enemy; - - // if (APlayerController* PC = Cast(GetWorld()->GetFirstPlayerController())) - // { - // PC->bShowMouseCursor = true; - // PC->bEnableClickEvents = true; - // PC->bEnableMouseOverEvents = true; - // } -} - -void ARealTimeCombat::EndCombat() -{ - //Remove the HUD from the viewport - HUD->RemoveFromViewport(); -} - -void ARealTimeCombat::OnMouseClick() -{ - ExecuteCast(CurrentComboString); -} - -void ARealTimeCombat::OnQPress() -{ - if (ActiveActionPoints <= 0) - { - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("No More Action Points")); - return; - } - if (IronResource <= 0) - { - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("No More Iron")); - return; - } - UseActionPoint(); - CurrentComboString.AppendChar('F'); - UpdateComboString(CurrentComboString); - IronResource -= 1; - UpdateResourceBars(); -} - -void ARealTimeCombat::OnEPress() -{ - if (ActiveActionPoints <= 0) - { - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("No More Action Points")); - return; - } - if (SulfurResource <= 0) - { - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("No More Sulfur")); - return; - } - UseActionPoint(); - CurrentComboString.AppendChar('W'); - UpdateComboString(CurrentComboString); - SulfurResource -= 1; - UpdateResourceBars(); -} - -void ARealTimeCombat::OnBackspacePress() -{ - if (CurrentComboString.Len() <= 0) - { - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Blank Combo")); - return; - } - ReuseActionPoint(); - if (CurrentComboString.Right(1) == "F") - { - IronResource += 1; - } - else if (CurrentComboString.Right(1) == "W") - { - SulfurResource += 1; - } - CurrentComboString.RemoveAt(CurrentComboString.Len() - 1); - UpdateComboString(CurrentComboString); - UpdateResourceBars(); -} - -void ARealTimeCombat::BeginPlay() -{ - Super::BeginPlay(); - - TArray AllCharacterActorsInScene; - UGameplayStatics::GetAllActorsOfClassWithTag(GetWorld(), AActor::StaticClass(), FName("Enemy"), AllCharacterActorsInScene); - for (AActor* Actor : AllCharacterActorsInScene) - { - EnemyActor = Cast(Actor); - } - - UGameplayStatics::GetAllActorsOfClassWithTag(GetWorld(), AActor::StaticClass(), FName("Player"), AllCharacterActorsInScene); - for (AActor* Actor : AllCharacterActorsInScene) - { - PlayerActor = Cast(Actor); - } - - HUD = CreateWidget(GetWorld(), HUDWidget); - - CurrentComboTextBlock = Cast(HUD->GetWidgetFromName("CurrentCombo")); - ActionPointsTextBlock = Cast(HUD->GetWidgetFromName("ActionPoints")); - BattleLogTextBlock = Cast(HUD->GetWidgetFromName("BattleLog")); - PlayerHealthBar = Cast(HUD->GetWidgetFromName("PlayerHealthBar")); - EnemyHealthBar = Cast(HUD->GetWidgetFromName("EnemyHealthBar")); - IronResourceBar = Cast(HUD->GetWidgetFromName("IronResourceBar")); - SulfurResourceBar = Cast(HUD->GetWidgetFromName("SulfurResourceBar")); - ActionPointsBar = Cast(HUD->GetWidgetFromName("ActionPointsBar")); -} - -void ARealTimeCombat::ExecuteCast(FString Combo) -{ - if (!IsValidCombo(Combo)) - { - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Invalid Combo")); - //For each character in the current combo add back the resource - for (int i = 0; i < Combo.Len(); i++) - { - if (Combo[i] == 'F') - { - IronResource += 1; - } - else if (Combo[i] == 'W') - { - SulfurResource += 1; - } - } - CurrentComboString = ""; - UpdateComboString(CurrentComboString); - RevertActionPoints(); - UpdateActionPoints(); - UpdateResourceBars(); - return; - } - - CurrentComboString = ""; - UpdateComboString(CurrentComboString); - RevertActionPoints(); - UpdateActionPoints(); - - if (!HitEnemy()) - { - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Missed")); - return; - } - - switch (bIsPlayerTurn) - { - case true: - // Player Turn - DamageEnemy(*ValidCombos.Find(Combo)); - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("Enemy Damaged %d"), *ValidCombos.Find(Combo))); - break; - case false: - // Enemy Turn - DamagePlayer(*ValidCombos.Find(Combo)); - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("Player Damaged %d"), *ValidCombos.Find(Combo))); - break; - } - //End Combat if either the player or enemy is dead - if (EnemyHealth <= 0) - { - EndCombat(); - EnemyActor->Destroy(); - return; - } - if (PlayerHealth <= 0) - { - EndCombat(); - return; - } - - // SwitchTurn(); -} - -void ARealTimeCombat::UseActionPoint() -{ - if (HeldActionPoints > 0 && ActiveActionPoints <= HeldActionPoints) - { - ActiveActionPoints -= 1; - UpdateActionPoints(); - } -} - -void ARealTimeCombat::ReuseActionPoint() -{ - ActiveActionPoints += 1; - UpdateActionPoints(); -} - -void ARealTimeCombat::RevertActionPoints() -{ - ActiveActionPoints = HeldActionPoints; - UpdateActionPoints(); -} - -void ARealTimeCombat::DamagePlayer(int Damage) -{ - PlayerHealth -= FMath::Clamp(Damage, 0, 100); - UpdateProgressBars(); - AddBattleLogMessage("Player was damaged for " + FString::FromInt(Damage) + " damage."); -} - -void ARealTimeCombat::DamageEnemy(int Damage) -{ - EnemyHealth -= FMath::Clamp(Damage, 0, 100); - UpdateProgressBars(); - AddBattleLogMessage("Enemy was damaged for " + FString::FromInt(Damage) + " damage."); -} - -void ARealTimeCombat::UpdateProgressBars() const -{ - PlayerHealthBar->SetPercent(PlayerHealth / 100.0f); - EnemyHealthBar->SetPercent(EnemyHealth / 100.0f); -} - -void ARealTimeCombat::Tick(float DeltaSeconds) -{ - Super::Tick(DeltaSeconds); - if (ActionPointsTimer >= 1.0f && HeldActionPoints < MaxActionPoints && bStartTimer) - { - HeldActionPoints += 1; - ActiveActionPoints += 1; - UpdateActionPoints(); - ActionPointsTimer = 0.0f; - } - else - { - ActionPointsTimer += DeltaSeconds; - ActionPointsBar->SetPercent(ActionPointsTimer); - } -} - -bool ARealTimeCombat::IsValidCombo(FString Combo) const -{ - return ValidCombos.Contains(Combo); -} - -void ARealTimeCombat::UpdateComboString(FString NewCombo) const -{ - CurrentComboTextBlock->SetText(FText::FromString(NewCombo)); -} - -void ARealTimeCombat::UpdateActionPoints() const -{ - ActionPointsTextBlock->SetText(FText::FromString(FString::FromInt(ActiveActionPoints))); -} - -void ARealTimeCombat::AddBattleLogMessage(FString Message) -{ - BattleLog.Append(Message + "\n"); - UpdateBattleLog(); -} - -void ARealTimeCombat::ClearBattleLog() -{ - BattleLog = ""; -} - -void ARealTimeCombat::UpdateBattleLog() -{ - TArray TempArray; - if (const int32 LineCount = BattleLog.ParseIntoArray(TempArray, TEXT("\n"), true); LineCount > 10) - { - ClearBattleLog(); - } - BattleLogTextBlock->SetText(FText::FromString(BattleLog)); -} - -void ARealTimeCombat::UpdateResourceBars() const -{ - IronResourceBar->SetPercent(IronResource / 10.0f); - SulfurResourceBar->SetPercent(SulfurResource / 10.0f); -} - -bool ARealTimeCombat::HitEnemy() const -{ - FHitResult HitResult; - FVector Start = PlayerActor->GetActorLocation(); - FVector End = PlayerActor->GetActorForwardVector() * 1000.0f + Start; - FCollisionQueryParams CollisionParams; - CollisionParams.AddIgnoredActor(PlayerActor); - if (GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECC_Pawn, CollisionParams)) - { - DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 5.0f, 0, 10.0f); - if (HitResult.GetActor() == EnemyActor) - { - return true; - } - } - DrawDebugLine(GetWorld(), Start, End, FColor::Red, false, 5.0f, 0, 10.0f); - return false; -} diff --git a/Source/the_twilight_abyss/RealTimeCombat/RealTimeCombat.h b/Source/the_twilight_abyss/RealTimeCombat/RealTimeCombat.h deleted file mode 100644 index c6cfae9..0000000 --- a/Source/the_twilight_abyss/RealTimeCombat/RealTimeCombat.h +++ /dev/null @@ -1,127 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#pragma once - -#include "CoreMinimal.h" -#include "Components/Button.h" -#include "Components/ProgressBar.h" -#include "Components/TextBlock.h" -#include "GameFramework/GameStateBase.h" -#include "RealTimeCombat.generated.h" - -UCLASS() -class THE_TWILIGHT_ABYSS_API ARealTimeCombat : public AGameStateBase -{ - GENERATED_BODY() - ARealTimeCombat(); - - UPROPERTY(EditDefaultsOnly) - int PlayerHealth = 100; - UPROPERTY(EditDefaultsOnly) - int EnemyHealth = 100; - UPROPERTY(EditDefaultsOnly) - int MaxActionPoints = 3; - UPROPERTY(EditDefaultsOnly) - int ActiveActionPoints = 0; - UPROPERTY(EditDefaultsOnly) - int IronResource = 10; // F - UPROPERTY(EditDefaultsOnly) - int SulfurResource = 10; // W - - UPROPERTY(VisibleAnywhere) - AActor* PlayerActor; - UPROPERTY(VisibleAnywhere) - AActor* EnemyActor; - // AActor* ActiveActor; - - /* - TODO: - Reference Player Inventory - */ - UPROPERTY(EditAnywhere) - TSubclassOf HUDWidget; - UPROPERTY(EditAnywhere) - TMap ValidCombos = - { - {"F", 10}, - {"W", 10}, - {"WW", 15}, - {"FW", 20}, - {"FFW", 30} - }; - - FString BattleLog; - - UFUNCTION(BlueprintCallable) - void StartCombat(); - UFUNCTION(BlueprintCallable) - void EndCombat(); - UFUNCTION(BlueprintCallable) - void OnMouseClick(); - UFUNCTION(BlueprintCallable) - void OnQPress(); - UFUNCTION(BlueprintCallable) - void OnEPress(); - UFUNCTION(BlueprintCallable) - void OnBackspacePress(); - -protected: - virtual void BeginPlay() override; - void ExecuteCast(FString Combo); - void UseActionPoint(); - void ReuseActionPoint(); - void RevertActionPoints(); - void DamagePlayer(int Damage); - void DamageEnemy(int Damage); - void UpdateProgressBars() const; - virtual void Tick(float DeltaSeconds) override; - -private: - bool IsValidCombo(FString Combo) const; - float ActionPointsTimer = 0.0f; - int HeldActionPoints = 0; - - UPROPERTY() - UUserWidget* HUD; - - UPROPERTY(VisibleAnywhere) - bool bIsPlayerTurn = true; - - UPROPERTY(VisibleAnywhere) - FString CurrentComboString = ""; - - UPROPERTY(VisibleAnywhere) - UTextBlock* CurrentComboTextBlock; - - UPROPERTY(VisibleAnywhere) - UTextBlock* BattleLogTextBlock; - - UPROPERTY(VisibleAnywhere) - UTextBlock* ActionPointsTextBlock; - - UPROPERTY(VisibleAnywhere) - UProgressBar* PlayerHealthBar; - - UPROPERTY(VisibleAnywhere) - UProgressBar* EnemyHealthBar; - - UPROPERTY(VisibleAnywhere) - UProgressBar* IronResourceBar; - - UPROPERTY(VisibleAnywhere) - UProgressBar* SulfurResourceBar; - - UPROPERTY(VisibleAnywhere) - UProgressBar* ActionPointsBar; - - void UpdateComboString(FString NewCombo) const; - void UpdateActionPoints() const; - - void AddBattleLogMessage(FString Message); - void ClearBattleLog(); - void UpdateBattleLog(); - void UpdateResourceBars() const; - bool HitEnemy() const; - - bool bStartTimer = false; -}; diff --git a/Source/the_twilight_abyss/TurnBasedCombat/PlayerCharacterCombatTest.cpp b/Source/the_twilight_abyss/TurnBasedCombat/PlayerCharacterCombatTest.cpp deleted file mode 100644 index 99dbb55..0000000 --- a/Source/the_twilight_abyss/TurnBasedCombat/PlayerCharacterCombatTest.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - - -#include "PlayerCharacterCombatTest.h" - -// Sets default values -APlayerCharacterCombatTest::APlayerCharacterCombatTest() -{ - // Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it. - PrimaryActorTick.bCanEverTick = true; - - Tags.Add(FName("Character")); -} - -// Called when the game starts or when spawned -void APlayerCharacterCombatTest::BeginPlay() -{ - Super::BeginPlay(); - -} - -// Called every frame -void APlayerCharacterCombatTest::Tick(float DeltaTime) -{ - Super::Tick(DeltaTime); - -} - -// Called to bind functionality to input -void APlayerCharacterCombatTest::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) -{ - Super::SetupPlayerInputComponent(PlayerInputComponent); - -} - diff --git a/Source/the_twilight_abyss/TurnBasedCombat/PlayerCharacterCombatTest.h b/Source/the_twilight_abyss/TurnBasedCombat/PlayerCharacterCombatTest.h deleted file mode 100644 index ffffd26..0000000 --- a/Source/the_twilight_abyss/TurnBasedCombat/PlayerCharacterCombatTest.h +++ /dev/null @@ -1,29 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#pragma once - -#include "CoreMinimal.h" -#include "GameFramework/Character.h" -#include "PlayerCharacterCombatTest.generated.h" - -UCLASS() -class THE_TWILIGHT_ABYSS_API APlayerCharacterCombatTest : public ACharacter -{ - GENERATED_BODY() - -public: - // Sets default values for this character's properties - APlayerCharacterCombatTest(); - -protected: - // Called when the game starts or when spawned - virtual void BeginPlay() override; - -public: - // Called every frame - virtual void Tick(float DeltaTime) override; - - // Called to bind functionality to input - virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; - -}; diff --git a/Source/the_twilight_abyss/TurnBasedCombat/TurnBaseCombat.cpp b/Source/the_twilight_abyss/TurnBasedCombat/TurnBaseCombat.cpp deleted file mode 100644 index 8856b35..0000000 --- a/Source/the_twilight_abyss/TurnBasedCombat/TurnBaseCombat.cpp +++ /dev/null @@ -1,297 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - - -#include "TurnBaseCombat.h" -#include "CoreMinimal.h" -#include "Blueprint/UserWidget.h" -#include "Components/TextBlock.h" -#include "Components/ProgressBar.h" -#include "Kismet/GameplayStatics.h" - -ATurnBaseCombat::ATurnBaseCombat() -{ - if (HUDWidget == nullptr) - { - // Load the HUD widget from the specified path - static ConstructorHelpers::FClassFinder HUDWidgetClass(TEXT("/Game/Blueprints/Combat_UI/Combat_UI")); - HUDWidget = HUDWidgetClass.Class; - } -} - -void ATurnBaseCombat::StartCombat(AActor* Enemy) -{ - if (HUD->IsInViewport()) return; - HUD->AddToViewport(); - EnemyActor = Enemy; - - if (APlayerController* PC = Cast(GetWorld()->GetFirstPlayerController())) - { - PC->bShowMouseCursor = true; - PC->bEnableClickEvents = true; - PC->bEnableMouseOverEvents = true; - } -} - -void ATurnBaseCombat::EndCombat() -{ - //Remove the HUD from the viewport - HUD->RemoveFromViewport(); -} - -void ATurnBaseCombat::BeginPlay() -{ - Super::BeginPlay(); - - TArray AllCharacterActorsInScene; - UGameplayStatics::GetAllActorsOfClassWithTag(GetWorld(), AActor::StaticClass(), FName("Character"), AllCharacterActorsInScene); - - HUD = CreateWidget(GetWorld(), HUDWidget); - - TurnIndicatorTextBlock = Cast(HUD->GetWidgetFromName("TurnIndicator")); - CurrentComboTextBlock = Cast(HUD->GetWidgetFromName("CurrentCombo")); - ActionPointsTextBlock = Cast(HUD->GetWidgetFromName("ActionPoints")); - BattleLogTextBlock = Cast(HUD->GetWidgetFromName("BattleLog")); - PlayerHealthBar = Cast(HUD->GetWidgetFromName("PlayerHealthBar")); - EnemyHealthBar = Cast(HUD->GetWidgetFromName("EnemyHealthBar")); - IronResourceBar = Cast(HUD->GetWidgetFromName("IronResourceBar")); - SulfurResourceBar = Cast(HUD->GetWidgetFromName("SulfurResourceBar")); - CastButton = Cast(HUD->GetWidgetFromName("CastButton")); - FButton = Cast(HUD->GetWidgetFromName("FButton")); - WButton = Cast(HUD->GetWidgetFromName("WButton")); - BackspaceButton = Cast(HUD->GetWidgetFromName("BackspaceButton")); - CastButton->OnClicked.AddDynamic(this, &ATurnBaseCombat::CastButtonOnClick); - FButton->OnClicked.AddDynamic(this, &ATurnBaseCombat::FButtonOnClick); - WButton->OnClicked.AddDynamic(this, &ATurnBaseCombat::WButtonOnClick); - BackspaceButton->OnClicked.AddDynamic(this, &ATurnBaseCombat::BackspaceButtonOnClick); -} - -void ATurnBaseCombat::ExecuteCast(FString Combo) -{ - if (!IsValidCombo(Combo)) - { - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Invalid Combo")); - //For each character in the current combo add back the resource - for (int i = 0; i < Combo.Len(); i++) - { - if (Combo[i] == 'F') - { - IronResource += 1; - } - else if (Combo[i] == 'W') - { - SulfurResource += 1; - } - } - CurrentComboString = ""; - UpdateComboString(CurrentComboString); - RevertActionPoints(); - UpdateActionPoints(); - UpdateResourceBars(); - return; - } - - CurrentComboString = ""; - UpdateComboString(CurrentComboString); - RevertActionPoints(); - UpdateActionPoints(); - - switch (bIsPlayerTurn) - { - case true: - // Player Turn - DamageEnemy(*ValidCombos.Find(Combo)); - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("Enemy Damaged %d"), *ValidCombos.Find(Combo))); - break; - case false: - // Enemy Turn - DamagePlayer(*ValidCombos.Find(Combo)); - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, FString::Printf(TEXT("Player Damaged %d"), *ValidCombos.Find(Combo))); - break; - } - //End Combat if either the player or enemy is dead - if (EnemyHealth <= 0) - { - EndCombat(); - EnemyActor->Destroy(); - return; - } - if (PlayerHealth <= 0) - { - EndCombat(); - return; - } - - SwitchTurn(); -} - -void ATurnBaseCombat::UseActionPoint() -{ - ActiveActionPoints += 1; - UpdateActionPoints(); -} - -void ATurnBaseCombat::ReuseActionPoint() -{ - ActiveActionPoints -= 1; - UpdateActionPoints(); -} - -void ATurnBaseCombat::RevertActionPoints() -{ - ActiveActionPoints = 0; - UpdateActionPoints(); -} - -void ATurnBaseCombat::DamagePlayer(int Damage) -{ - PlayerHealth -= FMath::Clamp(Damage, 0, 100); - UpdateProgressBars(); - AddBattleLogMessage("Player was damaged for " + FString::FromInt(Damage) + " damage."); -} - -void ATurnBaseCombat::DamageEnemy(int Damage) -{ - EnemyHealth -= FMath::Clamp(Damage, 0, 100); - UpdateProgressBars(); - AddBattleLogMessage("Enemy was damaged for " + FString::FromInt(Damage) + " damage."); -} - -void ATurnBaseCombat::UpdateProgressBars() const -{ - PlayerHealthBar->SetPercent(PlayerHealth / 100.0f); - EnemyHealthBar->SetPercent(EnemyHealth / 100.0f); -} - -bool ATurnBaseCombat::IsValidCombo(FString Combo) const -{ - return ValidCombos.Contains(Combo); -} - -void ATurnBaseCombat::SwitchTurn() -{ - //TurnIndicatorTextBlock->SetText(FText::FromString(bIsPlayerTurn ? "Enemy Turn" : "Player Turn")); - //bIsPlayerTurn = !bIsPlayerTurn; - TurnIndicatorTextBlock->SetText(FText::FromString("Enemy Turn")); - ToggleButtons(); - //wait for 2 seconds - FTimerHandle UnusedHandle; - GetWorldTimerManager().SetTimer(UnusedHandle, this, &ATurnBaseCombat::EnemyTurn, 2.0f, false); - - //activeActor = bIsPlayerTurn ? enemyActor : playerActor; -} - -void ATurnBaseCombat::CastButtonOnClick() -{ - ExecuteCast(CurrentComboString); -} - -void ATurnBaseCombat::FButtonOnClick() -{ - if (ActiveActionPoints >= DefaultActionPoints) - { - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("No More Action Points")); - return; - } - if (IronResource <= 0) - { - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("No More Iron")); - return; - } - UseActionPoint(); - CurrentComboString.AppendChar('F'); - UpdateComboString(CurrentComboString); - IronResource -= 1; - UpdateResourceBars(); -} - -void ATurnBaseCombat::WButtonOnClick() -{ - if (ActiveActionPoints >= DefaultActionPoints) - { - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("No More Action Points")); - return; - } - if (SulfurResource <= 0) - { - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("No More Sulfur")); - return; - } - UseActionPoint(); - CurrentComboString.AppendChar('W'); - UpdateComboString(CurrentComboString); - SulfurResource -= 1; - UpdateResourceBars(); -} - -void ATurnBaseCombat::BackspaceButtonOnClick() -{ - if (CurrentComboString.Len() <= 0) - { - GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Blank Combo")); - return; - } - ReuseActionPoint(); - if (CurrentComboString.Right(1) == "F") - { - IronResource += 1; - } - else if (CurrentComboString.Right(1) == "W") - { - SulfurResource += 1; - } - CurrentComboString.RemoveAt(CurrentComboString.Len() - 1); - UpdateComboString(CurrentComboString); - UpdateResourceBars(); -} - -void ATurnBaseCombat::UpdateComboString(FString NewCombo) const -{ - CurrentComboTextBlock->SetText(FText::FromString(NewCombo)); -} - -void ATurnBaseCombat::UpdateActionPoints() const -{ - ActionPointsTextBlock->SetText(FText::FromString(FString::FromInt(ActiveActionPoints))); -} - -void ATurnBaseCombat::AddBattleLogMessage(FString Message) -{ - BattleLog.Append(Message + "\n"); - UpdateBattleLog(); -} - -void ATurnBaseCombat::ClearBattleLog() -{ - BattleLog = ""; -} - -void ATurnBaseCombat::UpdateBattleLog() -{ - TArray TempArray; - if (const int32 LineCount = BattleLog.ParseIntoArray(TempArray, TEXT("\n"), true); LineCount > 10) - { - ClearBattleLog(); - } - BattleLogTextBlock->SetText(FText::FromString(BattleLog)); -} - -void ATurnBaseCombat::UpdateResourceBars() const -{ - IronResourceBar->SetPercent(IronResource / 10.0f); - SulfurResourceBar->SetPercent(SulfurResource / 10.0f); -} - -void ATurnBaseCombat::ToggleButtons() const -{ - FButton->SetIsEnabled(!FButton->bIsEnabled); - WButton->SetIsEnabled(!WButton->bIsEnabled); - BackspaceButton->SetIsEnabled(!BackspaceButton->bIsEnabled); - CastButton->SetIsEnabled(!CastButton->bIsEnabled); -} - -void ATurnBaseCombat::EnemyTurn() -{ - DamagePlayer(10); - TurnIndicatorTextBlock->SetText(FText::FromString("Player Turn")); - ToggleButtons(); -} diff --git a/Source/the_twilight_abyss/TurnBasedCombat/TurnBaseCombat.h b/Source/the_twilight_abyss/TurnBasedCombat/TurnBaseCombat.h deleted file mode 100644 index 8b8409a..0000000 --- a/Source/the_twilight_abyss/TurnBasedCombat/TurnBaseCombat.h +++ /dev/null @@ -1,145 +0,0 @@ -// Fill out your copyright notice in the Description page of Project Settings. - -#pragma once - -#include "CoreMinimal.h" -#include "Components/Button.h" -#include "Components/ProgressBar.h" -#include "Components/TextBlock.h" -#include "GameFramework/GameStateBase.h" -#include "TurnBaseCombat.generated.h" - -/** - * - */ -UCLASS() -class THE_TWILIGHT_ABYSS_API ATurnBaseCombat : public AGameStateBase -{ - GENERATED_BODY() - -public: - ATurnBaseCombat(); - - UPROPERTY(EditDefaultsOnly) - int PlayerHealth = 100; - UPROPERTY(EditDefaultsOnly) - int EnemyHealth = 100; - UPROPERTY(EditDefaultsOnly) - int DefaultActionPoints = 3; - UPROPERTY(EditDefaultsOnly) - int ActiveActionPoints = 0; - UPROPERTY(EditDefaultsOnly) - int IronResource = 10; // F - UPROPERTY(EditDefaultsOnly) - int SulfurResource = 10; // W - - // AActor* PlayerActor; - UPROPERTY(VisibleAnywhere) - AActor* EnemyActor; - // AActor* ActiveActor; - - /* - TODO: - Reference Player Inventory - */ - UPROPERTY(EditAnywhere) - TSubclassOf HUDWidget; - UPROPERTY(EditAnywhere) - TMap ValidCombos = - { - {"F", 10}, - {"W", 10}, - {"WW", 15}, - {"FW", 20}, - {"FFW", 30} - }; - - FString BattleLog; - - UFUNCTION(BlueprintCallable) - void StartCombat(AActor* Enemy); - UFUNCTION(BlueprintCallable) - void EndCombat(); - -protected: - virtual void BeginPlay() override; - void ExecuteCast(FString Combo); - void UseActionPoint(); - void ReuseActionPoint(); - void RevertActionPoints(); - void DamagePlayer(int Damage); - void DamageEnemy(int Damage); - void UpdateProgressBars() const; - -private: - bool IsValidCombo(FString Combo) const; - - UPROPERTY() - UUserWidget* HUD; - - UPROPERTY(VisibleAnywhere) - bool bIsPlayerTurn = true; - - UPROPERTY(VisibleAnywhere) - FString CurrentComboString = ""; - - void SwitchTurn(); - - UPROPERTY(VisibleAnywhere) - UTextBlock* TurnIndicatorTextBlock; - - UPROPERTY(VisibleAnywhere) - UTextBlock* CurrentComboTextBlock; - - UPROPERTY(VisibleAnywhere) - UTextBlock* BattleLogTextBlock; - - UPROPERTY(VisibleAnywhere) - UTextBlock* ActionPointsTextBlock; - - UPROPERTY(VisibleAnywhere) - UProgressBar* PlayerHealthBar; - - UPROPERTY(VisibleAnywhere) - UProgressBar* EnemyHealthBar; - - UPROPERTY(VisibleAnywhere) - UProgressBar* IronResourceBar; - - UPROPERTY(VisibleAnywhere) - UProgressBar* SulfurResourceBar; - - UPROPERTY(VisibleAnywhere) - UButton* CastButton; - - UPROPERTY(VisibleAnywhere) - UButton* FButton; - - UPROPERTY(VisibleAnywhere) - UButton* WButton; - - UPROPERTY(VisibleAnywhere) - UButton* BackspaceButton; - - UFUNCTION() - void CastButtonOnClick(); - - UFUNCTION() - void FButtonOnClick(); - - UFUNCTION() - void WButtonOnClick(); - - UFUNCTION() - void BackspaceButtonOnClick(); - - void UpdateComboString(FString NewCombo) const; - void UpdateActionPoints() const; - - void AddBattleLogMessage(FString Message); - void ClearBattleLog(); - void UpdateBattleLog(); - void UpdateResourceBars() const; - void ToggleButtons() const; - void EnemyTurn(); -}; From 8b2b9d56cbcad766611904f5a5064ca673065142 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Mon, 30 Jan 2023 23:03:50 +0000 Subject: [PATCH 18/31] Updated HoldToInitCombat for Unreal Naming Conventions --- .../TurnBasedCombatV2/HoldToInitCombat.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp index 22fd2a7..7084e10 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp @@ -24,11 +24,11 @@ void UHoldToInitCombat::BeginPlay() Super::BeginPlay(); InitCombatWidget = CreateWidget(GetWorld(), InitCombatWidgetClass); - UInputComponent* playerInputComponent = GetWorld()->GetFirstPlayerController()->InputComponent; + UInputComponent* PlayerInputComponent = GetWorld()->GetFirstPlayerController()->InputComponent; //Bind Right Mouse Button to the function OnRightClickDown - playerInputComponent->BindAction("RightClick", IE_Pressed, this, &UHoldToInitCombat::OnRightClickDown); + PlayerInputComponent->BindAction("RightClick", IE_Pressed, this, &UHoldToInitCombat::OnRightClickDown); //Bind Right Mouse Button to the function OnRightClickUp - playerInputComponent->BindAction("RightClick", IE_Released, this, &UHoldToInitCombat::OnRightClickUp); + PlayerInputComponent->BindAction("RightClick", IE_Released, this, &UHoldToInitCombat::OnRightClickUp); } From 6092c22a2bb47f903e81acc2d47fd7bbd7a3e8a6 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 31 Jan 2023 00:04:24 +0000 Subject: [PATCH 19/31] Updated TurnBasedCombat to Link Enemy Health --- .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 22 +++++++++++++------ .../TurnBasedCombatV2/TurnBaseCombatV2.h | 3 +-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index 7a73bb1..a249022 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -3,6 +3,7 @@ #include "TurnBaseCombatV2.h" #include "CoreMinimal.h" +#include "BehaviorTree/BlackboardComponent.h" #include "Blueprint/UserWidget.h" #include "Components/TextBlock.h" #include "Components/ProgressBar.h" @@ -12,7 +13,6 @@ // Sets default values ATurnBaseCombatV2::ATurnBaseCombatV2() { - if (HUDWidget == nullptr) { // Load the HUD widget from the specified path @@ -23,6 +23,14 @@ ATurnBaseCombatV2::ATurnBaseCombatV2() void ATurnBaseCombatV2::StartCombat(AActor* Enemy) { + if (Enemy == nullptr) return; + UBlackboardComponent* EnemyBlackboard = Cast(Enemy->GetComponentByClass(UBlackboardComponent::StaticClass())); + if (EnemyBlackboard->GetValueAsBool("IsInCombat")) return; + FProperty* HealthProperty = Enemy->GetClass()->FindPropertyByName(FName("Health")); + int32* EnemyHealthPtr = HealthProperty->ContainerPtrToValuePtr(Enemy); + + EnemyHealth = EnemyHealthPtr; + if (HUD->IsInViewport()) return; HUD->AddToViewport(); EnemyActor = Enemy; @@ -48,7 +56,7 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy) void ATurnBaseCombatV2::EndCombat() { //Remove the HUD from the viewport - HUD->RemoveFromViewport(); + HUD->RemoveFromParent(); APawn* PlayerPawn = Cast(GetWorld()->GetFirstPlayerController()->GetPawn()); PlayerPawn->bUseControllerRotationYaw = true; PlayerPawn->bUseControllerRotationPitch = true; @@ -153,7 +161,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo) break; } //End Combat if either the player or enemy is dead - if (EnemyHealth <= 0) + if (*EnemyHealth <= 0) { EndCombat(); EnemyActor->Destroy(); @@ -195,7 +203,7 @@ void ATurnBaseCombatV2::DamagePlayer(int Damage) void ATurnBaseCombatV2::DamageEnemy(int Damage) { - EnemyHealth -= FMath::Clamp(Damage, 0, 100); + *EnemyHealth -= FMath::Clamp(Damage, 0, 100); UpdateProgressBars(); AddBattleLogMessage("Enemy was damaged for " + FString::FromInt(Damage) + " damage."); } @@ -203,7 +211,7 @@ void ATurnBaseCombatV2::DamageEnemy(int Damage) void ATurnBaseCombatV2::UpdateProgressBars() const { PlayerHealthBar->SetPercent(PlayerHealth / 100.0f); - EnemyHealthBar->SetPercent(EnemyHealth / 100.0f); + EnemyHealthBar->SetPercent(*EnemyHealth / 100.0f); } bool ATurnBaseCombatV2::IsValidCombo(FString Combo) const @@ -220,7 +228,7 @@ void ATurnBaseCombatV2::SwitchTurn() //wait for 2 seconds FTimerHandle UnusedHandle; GetWorldTimerManager().SetTimer(UnusedHandle, this, &ATurnBaseCombatV2::EnemyTurn, 2.0f, false); - + //activeActor = bIsPlayerTurn ? enemyActor : playerActor; } @@ -338,4 +346,4 @@ void ATurnBaseCombatV2::EnemyTurn() DamagePlayer(10); TurnIndicatorTextBlock->SetText(FText::FromString("Player Turn")); ToggleButtons(); -} \ No newline at end of file +} diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h index 9260d84..7d019e2 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h @@ -21,11 +21,10 @@ class THE_TWILIGHT_ABYSS_API ATurnBaseCombatV2 : public AGameStateBase public: ATurnBaseCombatV2(); + int* EnemyHealth = nullptr; UPROPERTY(EditDefaultsOnly) int PlayerHealth = 100; UPROPERTY(EditDefaultsOnly) - int EnemyHealth = 100; - UPROPERTY(EditDefaultsOnly) int DefaultActionPoints = 3; UPROPERTY(EditDefaultsOnly) int ActiveActionPoints = 0; From e91d059c5672c2992d4a242673a7f64215156c8d Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 31 Jan 2023 00:29:53 +0000 Subject: [PATCH 20/31] Bugfix Enemy Runs Away when User Init Combat --- .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 7 +++++-- Source/the_twilight_abyss/the_twilight_abyss.Build.cs | 2 +- Source/the_twilight_abyssEditor.Target.cs | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index a249022..80e801e 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -3,8 +3,9 @@ #include "TurnBaseCombatV2.h" #include "CoreMinimal.h" -#include "BehaviorTree/BlackboardComponent.h" +#include "AIController.h" #include "Blueprint/UserWidget.h" +#include "BehaviorTree/BlackboardComponent.h" #include "Components/TextBlock.h" #include "Components/ProgressBar.h" #include "GameFramework/Character.h" @@ -24,8 +25,10 @@ ATurnBaseCombatV2::ATurnBaseCombatV2() void ATurnBaseCombatV2::StartCombat(AActor* Enemy) { if (Enemy == nullptr) return; - UBlackboardComponent* EnemyBlackboard = Cast(Enemy->GetComponentByClass(UBlackboardComponent::StaticClass())); + UBlackboardComponent* EnemyBlackboard = Cast(Enemy->GetInstigatorController())->GetBlackboardComponent(); + if (EnemyBlackboard->GetValueAsBool("IsInCombat")) return; + EnemyBlackboard->SetValueAsBool("IsInCombat", true); FProperty* HealthProperty = Enemy->GetClass()->FindPropertyByName(FName("Health")); int32* EnemyHealthPtr = HealthProperty->ContainerPtrToValuePtr(Enemy); diff --git a/Source/the_twilight_abyss/the_twilight_abyss.Build.cs b/Source/the_twilight_abyss/the_twilight_abyss.Build.cs index 98ba233..b8c5d17 100644 --- a/Source/the_twilight_abyss/the_twilight_abyss.Build.cs +++ b/Source/the_twilight_abyss/the_twilight_abyss.Build.cs @@ -8,7 +8,7 @@ public class the_twilight_abyss : ModuleRules { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Niagara" }); + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Niagara", "AIModule" }); PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); diff --git a/Source/the_twilight_abyssEditor.Target.cs b/Source/the_twilight_abyssEditor.Target.cs index 6a6f8ad..527000c 100644 --- a/Source/the_twilight_abyssEditor.Target.cs +++ b/Source/the_twilight_abyssEditor.Target.cs @@ -9,6 +9,7 @@ public class the_twilight_abyssEditorTarget : TargetRules { Type = TargetType.Editor; DefaultBuildSettings = BuildSettingsVersion.V2; + IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1; ExtraModuleNames.AddRange( new string[] { "the_twilight_abyss" } ); } } From 0de2753dfffcd56e982f49da1d56d60a8cdeb187 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 31 Jan 2023 00:30:45 +0000 Subject: [PATCH 21/31] Bugfix Clicking Instantly Activates Combat --- Content/BlueprintAI/AI/AIBruh.uasset | 4 +-- Content/BlueprintAI/AI/BTT_ChaseBruh.uasset | 4 +-- .../Combat_UI/CombatCharacter.uasset | 4 +-- Content/Levels/Top_layer_level.umap | 4 +-- .../TurnBasedCombatV2/HoldToInitCombat.cpp | 33 +++++++++++-------- 5 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Content/BlueprintAI/AI/AIBruh.uasset b/Content/BlueprintAI/AI/AIBruh.uasset index 43e3a9b..25592c5 100644 --- a/Content/BlueprintAI/AI/AIBruh.uasset +++ b/Content/BlueprintAI/AI/AIBruh.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f991e2ffa722c07c9b215206e7e72e5f3405afb1da07d40d608f47419c25ecfd -size 79285 +oid sha256:800bdc6bd6084e775a08f93e15e6c3131bc1e42051c43aeed6cce77a4a694319 +size 82006 diff --git a/Content/BlueprintAI/AI/BTT_ChaseBruh.uasset b/Content/BlueprintAI/AI/BTT_ChaseBruh.uasset index cacd89d..93d5191 100644 --- a/Content/BlueprintAI/AI/BTT_ChaseBruh.uasset +++ b/Content/BlueprintAI/AI/BTT_ChaseBruh.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:da96ad8696b48b09139d79173aea8aea87bfb325c8f817e7ccf413d95f3f034f -size 39894 +oid sha256:93fb62549b8029d2b30422681be1c1a29b22b4819a7b8c94eaec4167a4119c65 +size 31978 diff --git a/Content/Blueprints/Combat_UI/CombatCharacter.uasset b/Content/Blueprints/Combat_UI/CombatCharacter.uasset index 95ef963..55906c5 100644 --- a/Content/Blueprints/Combat_UI/CombatCharacter.uasset +++ b/Content/Blueprints/Combat_UI/CombatCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:465dda65f6f573e5b213f73e85bf00219e3bbcc762d215532bb138add6695028 -size 82954 +oid sha256:bbeca26ba4c4db596230911c57de53af1607b63511991f401db6ada791cf2cac +size 73547 diff --git a/Content/Levels/Top_layer_level.umap b/Content/Levels/Top_layer_level.umap index 1517b01..a7c8fd3 100644 --- a/Content/Levels/Top_layer_level.umap +++ b/Content/Levels/Top_layer_level.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a4c3d9a7f84050a825d8d4c34139d5af6df268aa9765795bc651731bc4c4ca50 -size 219357 +oid sha256:efa810ba341773ef70924459587a5bbcb3231863903517bdad8273090322f7ec +size 219702 diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp index 7084e10..de8f09c 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp @@ -37,17 +37,22 @@ void UHoldToInitCombat::TickComponent(float DeltaTime, ELevelTick TickType, FAct { Super::TickComponent(DeltaTime, TickType, ThisTickFunction); - //If the player is holding down the right mouse button for 3 seconds, then the player will enter combat mode - if (bRightClickDown && RightClickDownTime < 0.1f) + // //If the player is holding down the right mouse button for 3 seconds, then the player will enter combat mode + // if (bRightClickDown && RightClickDownTime < 0.1f) + // { + // RightClickDownTime += DeltaTime; + // } + // else if (bRightClickDown && RightClickDownTime >= 0.1f) + // { + // //Enter Combat Mode + // Cast(GetWorld()->GetGameState())->StartCombat(TargetEnemy); + // //UBlackboardComponent* TargetEnemyBlackboard = Cast(TargetEnemy->GetComponentByClass(UBlackboardComponent::StaticClass())); + // //TargetEnemyBlackboard->SetValueAsBool("IsInCombat", true); + // OnRightClickUp(); + // } + if (bRightClickDown) { - RightClickDownTime += DeltaTime; - } - else if (bRightClickDown && RightClickDownTime >= 0.1f) - { - //Enter Combat Mode Cast(GetWorld()->GetGameState())->StartCombat(TargetEnemy); - //UBlackboardComponent* TargetEnemyBlackboard = Cast(TargetEnemy->GetComponentByClass(UBlackboardComponent::StaticClass())); - //TargetEnemyBlackboard->SetValueAsBool("IsInCombat", true); OnRightClickUp(); } } @@ -58,7 +63,7 @@ void UHoldToInitCombat::OnRightClickDown() { TargetEnemy = RightClickHit; bRightClickDown = true; - InitCombatWidget->AddToViewport(); + //InitCombatWidget->AddToViewport(); } } @@ -68,7 +73,7 @@ void UHoldToInitCombat::OnRightClickUp() RightClickDownTime = 0.0f; if (InitCombatWidget->IsInViewport()) { - InitCombatWidget->RemoveFromViewport(); + InitCombatWidget->RemoveFromParent(); } } @@ -86,10 +91,10 @@ AActor* UHoldToInitCombat::LookingAtEnemy() const return HitResult.GetActor(); } if (HitResult.GetActor()->Tags.Contains("Break")) - { + { HitResult.GetActor()->Destroy(); - return nullptr; - } + return nullptr; + } } DrawDebugLine(GetWorld(), Start, End, FColor::Red, false, 5.0f, 0, 10.0f); return nullptr; From 3f8a2266c4c64a9df476f5631ef9424bb218e1d5 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 31 Jan 2023 00:32:03 +0000 Subject: [PATCH 22/31] Updated InitCombat to Decrease Combat Range --- .../the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp index de8f09c..edec171 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp @@ -80,7 +80,7 @@ void UHoldToInitCombat::OnRightClickUp() AActor* UHoldToInitCombat::LookingAtEnemy() const { FVector Start = GetOwner()->GetActorLocation(); - FVector End = GetOwner()->GetActorForwardVector() * 1500.0f + Start; + FVector End = GetOwner()->GetActorForwardVector() * 1000.0f + Start; FCollisionQueryParams CollisionParams; CollisionParams.AddIgnoredActor(GetOwner()); if (FHitResult HitResult; GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECC_Pawn, CollisionParams)) From d18c54763232d21d452340ca2392e76ab527eeca Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 31 Jan 2023 00:56:53 +0000 Subject: [PATCH 23/31] Bugfix Cursor Not Hiding After Combat --- Content/Levels/Top_layer_level.umap | 4 ++-- .../TurnBasedCombatV2/HoldToInitCombat.cpp | 4 ++-- .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 11 +++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Content/Levels/Top_layer_level.umap b/Content/Levels/Top_layer_level.umap index a7c8fd3..3bbb67c 100644 --- a/Content/Levels/Top_layer_level.umap +++ b/Content/Levels/Top_layer_level.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:efa810ba341773ef70924459587a5bbcb3231863903517bdad8273090322f7ec -size 219702 +oid sha256:ce4d6dc0fd250c921a0493922a225877cc4175e894f7bda04de42b6d6941109e +size 220298 diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp index edec171..da73c16 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp @@ -85,7 +85,7 @@ AActor* UHoldToInitCombat::LookingAtEnemy() const CollisionParams.AddIgnoredActor(GetOwner()); if (FHitResult HitResult; GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECC_Pawn, CollisionParams)) { - DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 5.0f, 0, 10.0f); + //DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 5.0f, 0, 10.0f); if (HitResult.GetActor()->Tags.Contains("Enemy")) { return HitResult.GetActor(); @@ -96,6 +96,6 @@ AActor* UHoldToInitCombat::LookingAtEnemy() const return nullptr; } } - DrawDebugLine(GetWorld(), Start, End, FColor::Red, false, 5.0f, 0, 10.0f); + //DrawDebugLine(GetWorld(), Start, End, FColor::Red, false, 5.0f, 0, 10.0f); return nullptr; } diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index 80e801e..c0edfb8 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -68,6 +68,17 @@ void ATurnBaseCombatV2::EndCombat() { PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController()); } + if (APlayerController* PC = Cast(GetWorld()->GetFirstPlayerController())) + { + PC->bShowMouseCursor = false; + PC->bEnableClickEvents = false; + PC->bEnableMouseOverEvents = false; + } + GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(false); + GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(false); + GetWorld()->GetFirstPlayerController()->bShowMouseCursor = false; + GetWorld()->GetFirstPlayerController()->bEnableClickEvents = false; + GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = false; } void ATurnBaseCombatV2::FKeyPressed() From f80f5f21ef8ea9e4c69c673c305af74296726763 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 31 Jan 2023 01:02:03 +0000 Subject: [PATCH 24/31] Bugfix Action Point Count Down --- .../the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index c0edfb8..4fb30da 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -317,7 +317,7 @@ void ATurnBaseCombatV2::UpdateComboString(FString NewCombo) const void ATurnBaseCombatV2::UpdateActionPoints() const { - ActionPointsTextBlock->SetText(FText::FromString(FString::FromInt(ActiveActionPoints))); + ActionPointsTextBlock->SetText(FText::FromString(FString::FromInt(DefaultActionPoints - ActiveActionPoints))); } void ATurnBaseCombatV2::AddBattleLogMessage(FString Message) From ad91d6eac7ac13c65c96fafc81f890696019b62d Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 31 Jan 2023 01:02:36 +0000 Subject: [PATCH 25/31] Updated GunEffect Changed Texture from White --- Content/Blueprints/Combat_UI/NS_GunEffect.uasset | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content/Blueprints/Combat_UI/NS_GunEffect.uasset b/Content/Blueprints/Combat_UI/NS_GunEffect.uasset index 484df23..0e7e0b6 100644 --- a/Content/Blueprints/Combat_UI/NS_GunEffect.uasset +++ b/Content/Blueprints/Combat_UI/NS_GunEffect.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9375494bd5fe3b69508c04d2e5f19de73629aa81b24ba1c91a99136a0179c9a8 -size 1192218 +oid sha256:98e3118e947a8661b40edd468bdcbb0b51d3c612af7117d5e0d9d6ca3d955c96 +size 1073632 From b84a16e926924c8d173a18feabda06262ae52c57 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 31 Jan 2023 01:21:49 +0000 Subject: [PATCH 26/31] Updated TurnBaseCombat to Link Health Values --- .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 8 +++++--- .../TurnBasedCombatV2/TurnBaseCombatV2.h | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index 4fb30da..0750f06 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -10,6 +10,7 @@ #include "Components/ProgressBar.h" #include "GameFramework/Character.h" #include "Kismet/GameplayStatics.h" +#include "the_twilight_abyss/PlayerTemp/TempCharacter.h" // Sets default values ATurnBaseCombatV2::ATurnBaseCombatV2() @@ -102,6 +103,7 @@ void ATurnBaseCombatV2::BeginPlay() { PlayerActor = Cast(Actor); } + PlayerHealth = &Cast(PlayerActor)->Health; HUD = CreateWidget(GetWorld(), HUDWidget); @@ -181,7 +183,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo) EnemyActor->Destroy(); return; } - if (PlayerHealth <= 0) + if (*PlayerHealth <= 0) { EndCombat(); return; @@ -210,7 +212,7 @@ void ATurnBaseCombatV2::RevertActionPoints() void ATurnBaseCombatV2::DamagePlayer(int Damage) { - PlayerHealth -= FMath::Clamp(Damage, 0, 100); + *PlayerHealth -= FMath::Clamp(Damage, 0, 100); UpdateProgressBars(); AddBattleLogMessage("Player was damaged for " + FString::FromInt(Damage) + " damage."); } @@ -224,7 +226,7 @@ void ATurnBaseCombatV2::DamageEnemy(int Damage) void ATurnBaseCombatV2::UpdateProgressBars() const { - PlayerHealthBar->SetPercent(PlayerHealth / 100.0f); + PlayerHealthBar->SetPercent(*PlayerHealth / 100.0f); EnemyHealthBar->SetPercent(*EnemyHealth / 100.0f); } diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h index 7d019e2..88f918d 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h @@ -22,8 +22,7 @@ public: ATurnBaseCombatV2(); int* EnemyHealth = nullptr; - UPROPERTY(EditDefaultsOnly) - int PlayerHealth = 100; + float* PlayerHealth = nullptr; UPROPERTY(EditDefaultsOnly) int DefaultActionPoints = 3; UPROPERTY(EditDefaultsOnly) From d9584f3b5504d2c8ef2bb88f5300f5b53d5d7c3a Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 31 Jan 2023 01:23:28 +0000 Subject: [PATCH 27/31] Removed Escape To Main Menu --- Content/Blueprints/Combat_UI/CombatCharacter.uasset | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content/Blueprints/Combat_UI/CombatCharacter.uasset b/Content/Blueprints/Combat_UI/CombatCharacter.uasset index 55906c5..d63a495 100644 --- a/Content/Blueprints/Combat_UI/CombatCharacter.uasset +++ b/Content/Blueprints/Combat_UI/CombatCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bbeca26ba4c4db596230911c57de53af1607b63511991f401db6ada791cf2cac -size 73547 +oid sha256:16d3c76e55c51d69133a001b7e0864d3b3453bf2414379215af36e3468f45f19 +size 72803 From 5b60412cf908d2055b1f1323690d2ffc08dcf98b Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 31 Jan 2023 01:25:54 +0000 Subject: [PATCH 28/31] Updated TurnBaseCombat to Reset Resource Values Temp until resource gathering --- .../the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index 0750f06..fbf9152 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -39,6 +39,9 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy) HUD->AddToViewport(); EnemyActor = Enemy; + IronResource = 10; + SulfurResource = 10; + if (APlayerController* PC = Cast(GetWorld()->GetFirstPlayerController())) { PC->bShowMouseCursor = true; From 45374da8bb51e6df539b6c11ae0edf4112b7c544 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 31 Jan 2023 01:39:42 +0000 Subject: [PATCH 29/31] Updated Combat System to Disengage from Combat --- Content/BlueprintAI/AI/BT_Bruh.uasset | 4 ++-- Content/Blueprints/Combat_UI/Combat_UI.uasset | 4 ++-- .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 11 +++++++++++ .../TurnBasedCombatV2/TurnBaseCombatV2.h | 6 ++++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Content/BlueprintAI/AI/BT_Bruh.uasset b/Content/BlueprintAI/AI/BT_Bruh.uasset index 2d51dcb..8c9e379 100644 --- a/Content/BlueprintAI/AI/BT_Bruh.uasset +++ b/Content/BlueprintAI/AI/BT_Bruh.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e1d788b5da4588cdcc0f487c37f6fb0de042672d3e874cbfad39b12336ede9fc -size 22998 +oid sha256:3808112aa42d25a44b52ffafe6703131ffa192d567f3b563aad1f433f066ff23 +size 22630 diff --git a/Content/Blueprints/Combat_UI/Combat_UI.uasset b/Content/Blueprints/Combat_UI/Combat_UI.uasset index aeebd00..416a260 100644 --- a/Content/Blueprints/Combat_UI/Combat_UI.uasset +++ b/Content/Blueprints/Combat_UI/Combat_UI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1f42716c7e52f59d5e57aabb8ff5699d656b0a43c6f95ad8802a31c9e13e0765 -size 77433 +oid sha256:52a0bccd38454b1877744bb682416d170c6d74c8de74517c8856432b45915b79 +size 78977 diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index fbf9152..11417e9 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -122,10 +122,12 @@ void ATurnBaseCombatV2::BeginPlay() FButton = Cast(HUD->GetWidgetFromName("FButton")); WButton = Cast(HUD->GetWidgetFromName("WButton")); BackspaceButton = Cast(HUD->GetWidgetFromName("BackspaceButton")); + RunButton = Cast(HUD->GetWidgetFromName("RunButton")); CastButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::CastButtonOnClick); FButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::FButtonOnClick); WButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::WButtonOnClick); BackspaceButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::BackspaceButtonOnClick); + RunButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::RunButtonOnClick); } void ATurnBaseCombatV2::ExecuteCast(FString Combo) @@ -315,6 +317,14 @@ void ATurnBaseCombatV2::BackspaceButtonOnClick() UpdateResourceBars(); } +void ATurnBaseCombatV2::RunButtonOnClick() +{ + UBlackboardComponent* EnemyBlackboard = Cast(EnemyActor->GetInstigatorController())->GetBlackboardComponent(); + + EnemyBlackboard->SetValueAsBool("IsInCombat", false); + EndCombat(); +} + void ATurnBaseCombatV2::UpdateComboString(FString NewCombo) const { CurrentComboTextBlock->SetText(FText::FromString(NewCombo)); @@ -358,6 +368,7 @@ void ATurnBaseCombatV2::ToggleButtons() const WButton->SetIsEnabled(!WButton->GetIsEnabled()); BackspaceButton->SetIsEnabled(!BackspaceButton->GetIsEnabled()); CastButton->SetIsEnabled(!CastButton->GetIsEnabled()); + RunButton->SetIsEnabled(!RunButton->GetIsEnabled()); } void ATurnBaseCombatV2::EnemyTurn() diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h index 88f918d..283ef1e 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h @@ -126,6 +126,9 @@ private: UPROPERTY(VisibleAnywhere) UButton* BackspaceButton; + UPROPERTY(VisibleAnywhere) + UButton* RunButton; + UFUNCTION() void CastButtonOnClick(); @@ -138,6 +141,9 @@ private: UFUNCTION() void BackspaceButtonOnClick(); + UFUNCTION() + void RunButtonOnClick(); + void UpdateComboString(FString NewCombo) const; void UpdateActionPoints() const; From ed0bcc7c76895dcd8692cbf8c0179febf90f9380 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 31 Jan 2023 01:48:35 +0000 Subject: [PATCH 30/31] Updated CombatCharacter to Spawn GunEffect onClick --- Content/Blueprints/Combat_UI/CombatCharacter.uasset | 4 ++-- .../TurnBasedCombatV2/HoldToInitCombat.cpp | 10 ++++++++++ .../TurnBasedCombatV2/HoldToInitCombat.h | 6 ++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Content/Blueprints/Combat_UI/CombatCharacter.uasset b/Content/Blueprints/Combat_UI/CombatCharacter.uasset index d63a495..99bf825 100644 --- a/Content/Blueprints/Combat_UI/CombatCharacter.uasset +++ b/Content/Blueprints/Combat_UI/CombatCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:16d3c76e55c51d69133a001b7e0864d3b3453bf2414379215af36e3468f45f19 -size 72803 +oid sha256:586959609b1c6b9689865f104836b4dd866cce0cda9be700a33d0db3805e6a67 +size 72727 diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp index da73c16..543908c 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.cpp @@ -65,6 +65,16 @@ void UHoldToInitCombat::OnRightClickDown() bRightClickDown = true; //InitCombatWidget->AddToViewport(); } + + if (GunEffect) + { + //Get Player Actor + const AActor* PlayerActor = GetWorld()->GetFirstPlayerController()->GetPawn(); + //Get Static Mesh Location on the player actor + const UStaticMeshComponent* GunComponent = Cast(PlayerActor->GetComponentsByTag(UPrimitiveComponent::StaticClass(), FName("Gun"))[0]); + const FVector GunLocationOffset = GunComponent->GetSocketTransform("Muzzle").TransformPosition(FVector(-100, 0, 0)); + UNiagaraFunctionLibrary::SpawnSystemAtLocation(GetWorld(), GunEffect, GunLocationOffset, PlayerActor->GetActorRotation()); + } } void UHoldToInitCombat::OnRightClickUp() diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.h b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.h index 3cba925..c29c0ca 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.h +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/HoldToInitCombat.h @@ -4,8 +4,11 @@ #include "CoreMinimal.h" #include "Components/ActorComponent.h" +#include "NiagaraComponent.h" +#include "NiagaraFunctionLibrary.h" #include "HoldToInitCombat.generated.h" +class UNiagaraSystem; UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent)) class THE_TWILIGHT_ABYSS_API UHoldToInitCombat : public UActorComponent @@ -20,6 +23,9 @@ public: UPROPERTY() TSubclassOf InitCombatWidgetClass; + UPROPERTY(EditDefaultsOnly) + UNiagaraSystem* GunEffect; + protected: // Called when the game starts virtual void BeginPlay() override; From 24aa97ea2e2daf8447f6a4133862fcfec94011f3 Mon Sep 17 00:00:00 2001 From: PHILIP WHITE Date: Tue, 31 Jan 2023 01:52:15 +0000 Subject: [PATCH 31/31] Update readme.md --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index e688752..da7878c 100644 --- a/readme.md +++ b/readme.md @@ -2,4 +2,6 @@ ## By Team 2:13 +### Character Dialogue + https://docs.google.com/spreadsheets/d/13iVCQuveBiaihpREnY145OZi5QT-1sseNoI0A5v8D1o/edit?usp=sharing