diff --git a/Config/DefaultEngine.ini b/Config/DefaultEngine.ini index b792816..f3f6b2f 100644 --- a/Config/DefaultEngine.ini +++ b/Config/DefaultEngine.ini @@ -128,3 +128,15 @@ CompressionQualityModifier=1.000000 AutoStreamingThreshold=0.000000 SoundCueCookQualityIndex=-1 +[/Script/GameplayDebugger.GameplayDebuggerConfig] +CategorySlot1=One +CategorySlot2=Two +CategorySlot3=Three +CategorySlot4=Four +CategorySlot5=Five +CategorySlot6=Six +CategorySlot7=Seven +CategorySlot8=Eight +CategorySlot9=Nine +CategorySlot0=Zero + diff --git a/Config/DefaultInput.ini b/Config/DefaultInput.ini index a87dbd8..8698439 100644 --- a/Config/DefaultInput.ini +++ b/Config/DefaultInput.ini @@ -82,6 +82,7 @@ DoubleClickTime=0.200000 +ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar) +ActionMappings=(ActionName="Interact",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=E) +ActionMappings=(ActionName="RightClick",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton) ++ActionMappings=(ActionName="Sneak",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftControl) +AxisMappings=(AxisName="Look Up / Down Gamepad",Scale=1.000000,Key=Gamepad_RightY) +AxisMappings=(AxisName="Look Up / Down Mouse",Scale=-1.000000,Key=MouseY) +AxisMappings=(AxisName="Move Forward / Backward",Scale=1.000000,Key=Gamepad_LeftY) diff --git a/Content/Assets/Objects/Caves/Blue_rocks.uasset b/Content/Assets/Objects/Caves/Blue_rocks.uasset index 8bd085a..51dd0d5 100644 --- a/Content/Assets/Objects/Caves/Blue_rocks.uasset +++ b/Content/Assets/Objects/Caves/Blue_rocks.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fcd050bbb60987754b5901bb0bdae71a95fd8dfb8f8db0c2c3286a64b2936912 -size 17673 +oid sha256:c023592a8525e65e2d03cbc1d31c22989f9c3c987d13ca4a1368cf288ded748f +size 14309 diff --git a/Content/Blueprints/Combat_UI/CombatCharacter.uasset b/Content/Blueprints/Combat_UI/CombatCharacter.uasset index 3b2c174..6078475 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:585edb5a7d5ed873e905c5150c3d20757177b5741d22806730b54a47415d472d -size 72618 +oid sha256:53c111471c3a161fb4ed5408ebeac5cfca08d224652308dbb07cac6d7b829d6b +size 76303 diff --git a/Content/Blueprints/Inventory_UI/WBP_ItemDisplay.uasset b/Content/Blueprints/Inventory_UI/WBP_ItemDisplay.uasset index 3980322..ccfcb16 100644 --- a/Content/Blueprints/Inventory_UI/WBP_ItemDisplay.uasset +++ b/Content/Blueprints/Inventory_UI/WBP_ItemDisplay.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:48426ed97184a867232380e93324520aeef1c39e773c7155c7caab764aa7f54a -size 86683 +oid sha256:3d9a901fca1810f64a4b9a9db9287ad7a5bc3f1567e7d778c72d94d0cf2e45ff +size 100059 diff --git a/Content/Blueprints/Inventory_UI/WBP_PlayerInventory.uasset b/Content/Blueprints/Inventory_UI/WBP_PlayerInventory.uasset index d2d7739..984f8e0 100644 --- a/Content/Blueprints/Inventory_UI/WBP_PlayerInventory.uasset +++ b/Content/Blueprints/Inventory_UI/WBP_PlayerInventory.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4177a97bce273fa21e43e1d37185390f84f3055fe4af730ea21754e8f3715246 -size 108778 +oid sha256:3940f6af26ff8d95d3e97b80d27b253544786ead926e582015eb17fb8da42daf +size 111618 diff --git a/Content/Blueprints/Items/AmmoItem.uasset b/Content/Blueprints/Items/AmmoItem.uasset new file mode 100644 index 0000000..9991ade --- /dev/null +++ b/Content/Blueprints/Items/AmmoItem.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d7e4e608a5183142630757d1496d08c76ac9cdcb16b039c3b2e51848ab89d9d +size 6552 diff --git a/Content/Blueprints/Items/ItemsInWorld/BP_AmmoItem.uasset b/Content/Blueprints/Items/ItemsInWorld/BP_AmmoItem.uasset new file mode 100644 index 0000000..fa2720b --- /dev/null +++ b/Content/Blueprints/Items/ItemsInWorld/BP_AmmoItem.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:733e8e625dc0b5a4b8e64f50ccda5397cdeb71aa75470f42b44a4c2606730875 +size 31844 diff --git a/Content/Blueprints/Items/ItemsInWorld/BP_HealingJellyItem.uasset b/Content/Blueprints/Items/ItemsInWorld/BP_HealingJellyItem.uasset index 5e94613..b53dd84 100644 --- a/Content/Blueprints/Items/ItemsInWorld/BP_HealingJellyItem.uasset +++ b/Content/Blueprints/Items/ItemsInWorld/BP_HealingJellyItem.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:32388bd47d08a69c1f782c682fdf67358fb2fdd5f9dd821ed9fc97d66a0bda70 -size 31327 +oid sha256:14abf326c7821612e3c60b5312759ae40948cadf47a909bf25201e0dfa39ea7d +size 31322 diff --git a/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset b/Content/Blueprints/Merchant/Merchant_UI/BP_OPENDIAL.uasset index 239df23..def3d97 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:dd57bdf81793aa6f3b76784e3be306fef5ca81c5e2fa7065a29abadd420c4e0b -size 75420 +oid sha256:ea25a76832a591caa677a97dfac6c30e410974dd3c705d8923f3eea49dd79699 +size 74712 diff --git a/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset b/Content/Blueprints/Merchant/Merchant_UI/BP_ShopSelector.uasset index 0c1f862..66e45ff 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:0fe126443f981aa1875e8efe299d76c4f0f570aff93f9313cc9503bb811365a5 -size 51324 +oid sha256:c2ca75bf7097c26b9d40760320303c440a1559518901fd42ca6f384fbff6ea2a +size 52542 diff --git a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyBuff.uasset index 7eecebb..a711020 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:abe53946825159c2220acd237c3cc7360478b63836d52e3cbe000876e43eb5d5 -size 63822 +oid sha256:f02d6f1b555bbb983a74a2a4534e22e262373f525b0f96234c48aa8a77c11f68 +size 64594 diff --git a/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset b/Content/Blueprints/Merchant/Merchant_UI/WBP_BuyHealing.uasset index 8e7650a..cb3480f 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:936f77df55a4f4c1baca361f8ca9384f1af821ab6c0e8c9b016a3ede25c9f8d1 -size 63821 +oid sha256:d21c0fb7a79d5390327eb841a5f67304a2ee6b13b68f3faa0c75ed276b1bf2f5 +size 64844 diff --git a/Content/Blueprints/Player/BP_MyTempCharacter.uasset b/Content/Blueprints/Player/BP_MyTempCharacter.uasset index d369a35..b161173 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:0954984bc9728f0b7488017e75a199b474190a8b9ff5412cc7869aece4c93b46 -size 54779 +oid sha256:8e348a27c5a931226dba531ec739fec1e28b9f912e91b46078ed811fe50f06bd +size 54956 diff --git a/Content/Dialogue/DialogueTest.umap b/Content/Dialogue/DialogueTest.umap new file mode 100644 index 0000000..f2a5797 --- /dev/null +++ b/Content/Dialogue/DialogueTest.umap @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6f2c0cc2d73c9fd35cf193c48ae0546bd41a9a10dedfe8c60d504fe09b55e819 +size 41343 diff --git a/Content/Dialogue/NPCTest.uasset b/Content/Dialogue/NPCTest.uasset new file mode 100644 index 0000000..e33f5cc --- /dev/null +++ b/Content/Dialogue/NPCTest.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d8d35e08f9a82472293b350e194a815b8e58c85084e33c6211de9f7c59a67a8 +size 47133 diff --git a/Content/Dialogue/TextPrompt.uasset b/Content/Dialogue/TextPrompt.uasset new file mode 100644 index 0000000..36af6e8 --- /dev/null +++ b/Content/Dialogue/TextPrompt.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9f186852f793c0cf57654d61c8314956651f3c41f25d508459e48d00f7ea0581 +size 45953 diff --git a/Content/Images/ammoicon.uasset b/Content/Images/ammoicon.uasset new file mode 100644 index 0000000..f2ed9de --- /dev/null +++ b/Content/Images/ammoicon.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c3fc688d58293f796f23824c1478b40cf0d62f868547a7f0e6bf25a471db496 +size 9826 diff --git a/Content/Levels/MerchantPrototype.umap b/Content/Levels/MerchantPrototype.umap index ea85903..e1f4942 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:838c48c134383d4b1db178233640e11ef2c4bcd49102f53648cf621dd1dcbf8a -size 27100 +oid sha256:c5cc473e60c24da835baacec54217c1f6c675c42c29643b889f07bff057a9c95 +size 34830 diff --git a/Content/Levels/Testing/BreakableWall_BP.uasset b/Content/Levels/Testing/BreakableWall_BP.uasset new file mode 100644 index 0000000..ba635b2 --- /dev/null +++ b/Content/Levels/Testing/BreakableWall_BP.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7215e1f1deff0cce99244ba8d52a19fd634917c6f477ac85df3172f66640f669 +size 48991 diff --git a/Content/Levels/Testing/CopyStalagite.uasset b/Content/Levels/Testing/CopyStalagite.uasset deleted file mode 100644 index b431889..0000000 --- a/Content/Levels/Testing/CopyStalagite.uasset +++ /dev/null @@ -1,3 +0,0 @@ -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 index 7ec9da9..24466ba 100644 --- a/Content/Levels/Testing/DestructableEnvironment.umap +++ b/Content/Levels/Testing/DestructableEnvironment.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3f06da83cd4d0159f28d9f56a2b3adfcefac21f62021d145a7a112422b75326c -size 38502 +oid sha256:52f5a712075e449782a7d9f79e633f4048945e39bcb21fd2af5f2e40c7925961 +size 37139 diff --git a/Content/Levels/Testing/Stalagite_GeometryCollection.uasset b/Content/Levels/Testing/Stalagite_GeometryCollection.uasset deleted file mode 100644 index 681a240..0000000 --- a/Content/Levels/Testing/Stalagite_GeometryCollection.uasset +++ /dev/null @@ -1,3 +0,0 @@ -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 bd00167..dbb4467 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:20da6d47858f856f405d19681f0d889313cac266b92b1bb758480317cf763453 -size 246392 +oid sha256:3ddfcf9a4f7c3b3ab626893a0d6d13cac4483f9a471bbdba97d0d00efc563dd7 +size 248803 diff --git a/Content/Particles/Break.uasset b/Content/Particles/Break.uasset new file mode 100644 index 0000000..2571998 --- /dev/null +++ b/Content/Particles/Break.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0583a0b2c5bb438f52fd4bc9c1f62f11651b39088209ac738386024a2777908 +size 2980419 diff --git a/Misc/Additional Resources/Links To Additional Resources.txt b/Misc/Additional Resources/Links To Additional Resources.txt index e79ccf7..51cbe97 100644 --- a/Misc/Additional Resources/Links To Additional Resources.txt +++ b/Misc/Additional Resources/Links To Additional Resources.txt @@ -4,3 +4,10 @@ Combat Spread Sheet: https://docs.google.com/spreadsheets/d/1s_uxjS8ir1pbt4-ofdOVpSPaQZVC8x9gQzS78bzE3KI/edit#gid=0 https://docs.google.com/document/d/1Y6eYoKQPw9n8gl7p030fmtPjfJcE132YHAvwL7Gk4jk/edit +Level Blueprints - https://docs.google.com/presentation/d/1ckx8IpO-BIxTFy19MJoUy7EuAMYOYoWQE6x1E2egr1o/edit?usp=sharing + +Art: + +Final Boss Moodboard - https://docs.google.com/presentation/d/1gX9ULwwuVboH_wPwBXa9AMLEhPbUqvfy5N3zeBOL89I/edit?usp=sharing +Art examples (Pre-Production) - https://docs.google.com/presentation/d/1Tc7nAdgg7ENsuV-6jGyYGHbYBLcY65losUjOYYhMHWs/edit?usp=sharing +Art Examples (Post-Production) - https://docs.google.com/presentation/d/1AEB9NNNOdRZfw2UrT9vZEwUF5QP9rvr0lqPNxoMJWCE/edit?usp=sharing \ No newline at end of file diff --git a/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp b/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp index a208bd0..2c808c8 100644 --- a/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp +++ b/Source/the_twilight_abyss/BaseItems/InventoryComponent.cpp @@ -40,13 +40,11 @@ bool UInventoryComponent::AddItem(class UBaseItem* BaseItem) BaseItem->StoredItems = this; BaseItem->World = GetWorld(); bool isNewItem = true; - // for every item in inventory for (auto & Item : Items) { //if the item is the same as the item that is being added if (Item->ItemDisplayName.ToString() == BaseItem->ItemDisplayName.ToString()) { - //add the amount of the item that is being added to the item in the inventory Item->StackCount++; UE_LOG(LogTemp, Display, TEXT("ITEM STACKCOUNT: %d"), Item->StackCount); isNewItem = false; diff --git a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.cpp b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.cpp index 2fac2d1..40ea61b 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.cpp +++ b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.cpp @@ -14,3 +14,4 @@ void UBaseItem::Use(ATempCharacter* Character) { } + diff --git a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h index 346966f..613c763 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h +++ b/Source/the_twilight_abyss/BaseItems/Items/BaseItem.h @@ -53,6 +53,9 @@ public: UPROPERTY(EditAnywhere, Category = "Item") bool isDamageBuffItem; + UPROPERTY(EditAnywhere, Category = "Item") + bool isAmmoItemType; + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Item") int32 StackCount = 1; @@ -69,4 +72,5 @@ public: //This is the same as the use item class but its in BP instead UFUNCTION(BlueprintImplementableEvent) void OnUse(class ATempCharacter* Character); + }; diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp index cc2c535..c481d7b 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.cpp @@ -16,26 +16,40 @@ void UEatableItems::Use(ATempCharacter* Character) { if(Character) { - if(isHealingItem == true) + if(isHealingItem) { - Character->Health += 10; - UE_LOG(LogTemp, Display, TEXT("Healed")); - //delete itself - Character->Inventory->RemoveItem(this); - + if (Character->Health < 100) + { + Character->Health += 10; + UE_LOG(LogTemp, Display, TEXT("Healed")); + Character->Inventory->RemoveItem(this); + } + else if (Character->Health >= 100) + { + UE_LOG(LogTemp, Display, TEXT("Health is full")); + } } - if(isDamageBuffItem == true) + + if(isDamageBuffItem) { // need to add the damage buff functionality here UE_LOG(LogTemp, Display, TEXT("Damage Buffed")); Character->Inventory->RemoveItem(this); } - } - /* - when player uses the item syrengine to debuff enemies - detect what enemie actors the player is fighting with - lower their damage by a value. - */ + if (isAmmoItemType) + { + TurnBaseCombat = GetWorld()->GetGameState(); + if (TurnBaseCombat->IronResource > 10) + { + TurnBaseCombat->IronResource += 5; + } + if (TurnBaseCombat->SulfurResource > 10) + { + TurnBaseCombat->SulfurResource += 5; + } + Character->Inventory->RemoveItem(this); + } + } } diff --git a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h index d636bcd..dadfc27 100644 --- a/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h +++ b/Source/the_twilight_abyss/BaseItems/Items/EatableItems.h @@ -4,6 +4,7 @@ #include "CoreMinimal.h" #include "BaseItem.h" +#include "the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h" #include "EatableItems.generated.h" /** @@ -19,4 +20,9 @@ class THE_TWILIGHT_ABYSS_API UEatableItems : public UBaseItem protected: virtual void Use(class ATempCharacter* Character) override; + + +private: + + ATurnBaseCombatV2* TurnBaseCombat; }; diff --git a/Source/the_twilight_abyss/Dialogue/DialogueNPC.cpp b/Source/the_twilight_abyss/Dialogue/DialogueNPC.cpp new file mode 100644 index 0000000..af4c7ba --- /dev/null +++ b/Source/the_twilight_abyss/Dialogue/DialogueNPC.cpp @@ -0,0 +1,118 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "DialogueNPC.h" +#include "Blueprint/UserWidget.h" +#include "Components/TextBlock.h" +#include "GameFramework/Character.h" + +// Sets default values for this component's properties +UDialogueNPC::UDialogueNPC() +{ + // Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features + // off to improve performance if you don't need them. + PrimaryComponentTick.bCanEverTick = true; + + static ConstructorHelpers::FClassFinder DialogueWidgetClass(TEXT("/Game/Dialogue/TextPrompt")); + DialogueWidget = DialogueWidgetClass.Class; +} + + +// Called when the game starts +void UDialogueNPC::BeginPlay() +{ + Super::BeginPlay(); + + DialogueWidgetInstance = CreateWidget(GetWorld(), DialogueWidget); + + NPCNameText = Cast(DialogueWidgetInstance->GetWidgetFromName("Text_Name")); + DialogueText = Cast(DialogueWidgetInstance->GetWidgetFromName("Text_Dialogue")); + NextButton = Cast(DialogueWidgetInstance->GetWidgetFromName("Button_Next")); + NextButton->OnClicked.AddDynamic(this, &UDialogueNPC::NextDialogue); +} + + +void UDialogueNPC::NextDialogue() +{ + //Dialogue Skip + if (CurrentDialogue.Len() < Dialogue[DialogueIndex].Len()) + { + CurrentDialogue = Dialogue[DialogueIndex]; + DialogueText->SetText(FText::FromString(CurrentDialogue)); + return; + } + + DialogueIndex++; + if (DialogueIndex >= Dialogue.Num()) + { + EndDialogue(); + return; + } + CurrentDialogue = ""; +} + +void UDialogueNPC::NextCharacter() +{ + if (DialogueIndex >= Dialogue.Num()) return; + + if (CurrentDialogue.Len() < Dialogue[DialogueIndex].Len()) + { + CurrentDialogue.AppendChar(Dialogue[DialogueIndex][CurrentDialogue.Len()]); + DialogueText->SetText(FText::FromString(CurrentDialogue)); + } +} + +// Called every frame +void UDialogueNPC::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) +{ + Super::TickComponent(DeltaTime, TickType, ThisTickFunction); + + // ... +} + +void UDialogueNPC::StartDialogue() +{ + //Disable Character Movement + if (ACharacter* PlayerCharacter = Cast(GetWorld()->GetFirstPlayerController()->GetPawn())) + { + PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController()); + } + //Set to UI Mode Only + APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); + PlayerController->SetInputMode(FInputModeUIOnly()); + PlayerController->bShowMouseCursor = true; + + DialogueWidgetInstance->AddToViewport(); + DialogueIndex = 1; + NPCNameText->SetText(FText::FromString(NPCName)); + CurrentDialogue = ""; + GetWorld()->GetTimerManager().SetTimer(TextAnimationTimerHandle, this, &UDialogueNPC::NextCharacter, TextAnimationSpeed, true); +} + +void UDialogueNPC::EndDialogue() +{ + TextAnimationTimerHandle.Invalidate(); + DialogueWidgetInstance->RemoveFromParent(); + + //Enable Character Movement + if (ACharacter* PlayerCharacter = Cast(GetWorld()->GetFirstPlayerController()->GetPawn())) + { + PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController()); + } + //Reset UI Mode + APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); + PlayerController->SetInputMode(FInputModeGameOnly()); + PlayerController->bShowMouseCursor = false; +} + +TArray UDialogueNPC::AddDialogue(FText TextInput, TArray DialogueArrayInput) +{ + if (TextInput.IsEmpty()) return DialogueArrayInput; + DialogueArrayInput.Add(TextInput.ToString()); + return DialogueArrayInput; +} + +void UDialogueNPC::GetFinalDialogue(TArray DialogueArray) +{ + Dialogue = DialogueArray; +} diff --git a/Source/the_twilight_abyss/Dialogue/DialogueNPC.h b/Source/the_twilight_abyss/Dialogue/DialogueNPC.h new file mode 100644 index 0000000..eeb8276 --- /dev/null +++ b/Source/the_twilight_abyss/Dialogue/DialogueNPC.h @@ -0,0 +1,82 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Components/ActorComponent.h" +#include "Components/Button.h" +#include "Components/TextBlock.h" +#include "DialogueNPC.generated.h" + +UENUM(BlueprintType) +enum class EChoices : uint8 +{ + Choice1 UMETA(DisplayName="Choice 1"), + Choice2 UMETA(DisplayName="Choice 2"), + Choice3 UMETA(DisplayName="Choice 3"), +}; + +UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent)) +class THE_TWILIGHT_ABYSS_API UDialogueNPC : public UActorComponent +{ + GENERATED_BODY() + +public: + // Sets default values for this component's properties + UDialogueNPC(); + + UPROPERTY(EditAnywhere) + FString NPCName; + + UPROPERTY() + TArray Dialogue; + + UPROPERTY(EditAnywhere) + float TextAnimationSpeed = 0.05f; + +protected: + // Called when the game starts + virtual void BeginPlay() override; + + UPROPERTY() + TSubclassOf DialogueWidget; + +private: + UPROPERTY() + UUserWidget* DialogueWidgetInstance; + + UPROPERTY() + UTextBlock* NPCNameText; + + UPROPERTY() + UTextBlock* DialogueText; + + UPROPERTY() + UButton* NextButton; + + int DialogueIndex = 1; + FString CurrentDialogue; + + UPROPERTY() + FTimerHandle TextAnimationTimerHandle; + + UFUNCTION() + void NextDialogue(); + void NextCharacter(); + +public: + // Called every frame + virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; + + UFUNCTION(BlueprintCallable) + void StartDialogue(); + + UFUNCTION(BlueprintCallable) + void EndDialogue(); + + UFUNCTION(BlueprintPure) + TArray AddDialogue(FText TextInput, TArray DialogueArrayInput); + + UFUNCTION(BlueprintCallable) + void GetFinalDialogue(TArray DialogueArray); +}; diff --git a/Source/the_twilight_abyss/Dialogue/InteractNPC.cpp b/Source/the_twilight_abyss/Dialogue/InteractNPC.cpp new file mode 100644 index 0000000..32ba171 --- /dev/null +++ b/Source/the_twilight_abyss/Dialogue/InteractNPC.cpp @@ -0,0 +1,54 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "InteractNPC.h" +#include "DialogueNPC.h" + + +// Sets default values for this component's properties +UInteractNPC::UInteractNPC() +{ + // Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features + // off to improve performance if you don't need them. + PrimaryComponentTick.bCanEverTick = true; + + // ... +} + + +// Called when the game starts +void UInteractNPC::BeginPlay() +{ + Super::BeginPlay(); + + // ... + +} + + +// Called every frame +void UInteractNPC::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) +{ + Super::TickComponent(DeltaTime, TickType, ThisTickFunction); + + // ... +} + +void UInteractNPC::Interact() +{ + FVector Start = GetOwner()->GetActorLocation(); + FVector End = GetOwner()->GetActorForwardVector() * 100.0f + Start; + FCollisionQueryParams CollisionParams; + CollisionParams.AddIgnoredActor(GetOwner()); + if (FHitResult HitResult; GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECC_Pawn, CollisionParams)) + { + //UE_LOG(LogTemp, Warning, TEXT("Hit: %s"), *HitResult.GetActor()->GetName()); + if (HitResult.GetActor()->Tags.Contains("NPC")) + { + //DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 5.0f, 0, 10.0f); + HitResult.GetActor()->FindComponentByClass()->StartDialogue(); + } + //DrawDebugLine(GetWorld(), Start, End, FColor::Red, false, 5.0f, 0, 10.0f); + } +} + diff --git a/Source/the_twilight_abyss/Dialogue/InteractNPC.h b/Source/the_twilight_abyss/Dialogue/InteractNPC.h new file mode 100644 index 0000000..6c76b27 --- /dev/null +++ b/Source/the_twilight_abyss/Dialogue/InteractNPC.h @@ -0,0 +1,29 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Components/ActorComponent.h" +#include "InteractNPC.generated.h" + + +UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent)) +class THE_TWILIGHT_ABYSS_API UInteractNPC : public UActorComponent +{ + GENERATED_BODY() + +public: + // Sets default values for this component's properties + UInteractNPC(); + +protected: + // Called when the game starts + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; + + UFUNCTION(BlueprintCallable) + void Interact(); +}; diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index bfdfe06..6710218 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -5,7 +5,11 @@ #include "Blueprint/UserWidget.h" #include "the_twilight_abyss/BaseItems/InventoryComponent.h" #include "the_twilight_abyss/BaseItems/Items/BaseItem.h" +#include "GameFramework/CharacterMovementComponent.h" #include "the_twilight_abyss/MerchantInteraction/Interaction.h" +#include +#include "Components/SphereComponent.h" +#include "Kismet/KismetMathLibrary.h" // CONSTRUCTOR @@ -17,6 +21,8 @@ ATempCharacter::ATempCharacter() Inventory->MaxItemSlots = 10; GoldBalance = GoldBalance; Health = Health; + this->GetCharacterMovement()->GetNavAgentPropertiesRef().bCanCrouch = true; + } // Called when the game starts or when spawned @@ -24,17 +30,61 @@ void ATempCharacter::BeginPlay() { Super::BeginPlay(); Health = 100; + ThisCamera = Cast(this->FindComponentByClass()); + PlayerCapsule = GetCapsuleComponent(); + TArray AllActorsInScene; + + //MAKE SURE POST PROCESSING IS IN THE SCENE OR GAME WILL CRASH + UGameplayStatics::GetAllActorsOfClass(GetWorld(), APostProcessVolume::StaticClass(), AllActorsInScene); + PostProcessVolume = Cast(AllActorsInScene[0]); + + Enemy = TEXT("Enemy"); + UGameplayStatics::GetAllActorsWithTag(GetWorld(), Enemy, AIActors); + + Ammo = TEXT("Ammo"); } //Binds the input we made in the setup player component to the forward vector void ATempCharacter::ForwardInput(float Axis) { - AddMovementInput(GetActorForwardVector() * Axis); + AddMovementInput(UKismetMathLibrary::GetForwardVector(FRotator(0, GetControlRotation().Yaw, 0)) * Axis); } //Binds the input we made in the setup player component to the right vector void ATempCharacter::RightMoveInput(float Axis) { - AddMovementInput(GetActorRightVector() * Axis); + AddMovementInput(UKismetMathLibrary::GetRightVector(FRotator(0, GetControlRotation().Yaw, 0)) * Axis); +} + +void ATempCharacter::Sneak() +{ + UE_LOG(LogTemp, Display, TEXT("Sneak activated")); + if (bIsCrouched) + { + UnCrouch(); + PostProcessVolume->Settings.VignetteIntensity = 0.0f; + for (AActor* Actor : AIActors) + { + USphereComponent* SphereComponent = Actor->FindComponentByClass(); + if (SphereComponent != nullptr) + { + SphereComponent->SetSphereRadius(40.0f); //default value + } + } + } + else + { + Crouch(); + for (AActor* Actor : AIActors) + { + USphereComponent* SphereComponent = Actor->FindComponentByClass(); + if (SphereComponent != nullptr) + { + SphereComponent->SetSphereRadius(15.0f); + } + } + PostProcessVolume->Settings.VignetteIntensity = 0.8f; + } + } @@ -52,6 +102,9 @@ void ATempCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCompo PlayerInputComponent->BindAxis(TEXT("Move Right / Left"), this, &ATempCharacter::RightMoveInput); PlayerInputComponent->BindAxis(TEXT("Turn Right / Left Mouse"), this, &ATempCharacter::AddControllerYawInput); PlayerInputComponent->BindAxis(TEXT("Look Up / Down Mouse"), this, &ATempCharacter::AddControllerPitchInput); + PlayerInputComponent->BindAction(TEXT("Jump"), IE_Pressed, this, &ATempCharacter::Jump); + PlayerInputComponent->BindAction(TEXT("Sneak"), IE_Pressed, this, &ATempCharacter::Sneak); + PlayerInputComponent->BindAction(TEXT("Sneak"), IE_Released, this, &ATempCharacter::Sneak); PlayerInputComponent->BindAction("Interact", IE_Pressed, this, &ATempCharacter::KeyPressed); } @@ -61,6 +114,8 @@ void ATempCharacter::KeyPressed() LineTraceLogic(); } + + // Line trace logic void ATempCharacter::LineTraceLogic() { @@ -85,6 +140,7 @@ void ATempCharacter::LineTraceLogic() } if(OutHit.GetActor()->FindComponentByClass()) { + UE_LOG(LogTemp, Display, TEXT("Hit Merchant")); auto ItemArray = OutHit.GetActor()->FindComponentByClass()->GetItem(0); if(GoldBalance >= ItemArray->ItemCostPrice) { @@ -96,6 +152,10 @@ void ATempCharacter::LineTraceLogic() { UE_LOG(LogTemp, Display, TEXT("Not Enough Gold")); } + if(OutHit.GetActor()->ActorHasTag(Ammo)) + { + OutHit.GetActor()->Destroy(); + } } // if the actor hit has the interaction component/script then it will activate the code @@ -138,49 +198,46 @@ 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; - GetWorld()->GetFirstPlayerController()->bEnableClickEvents = true; - GetWorld()->GetFirstPlayerController()->bEnableMouseOverEvents = true; - ThisCamera = Cast(this->FindComponentByClass()); - if (ThisCamera == nullptr) + //Disable Character Movement + if (ACharacter* PlayerCharacter = Cast(GetWorld()->GetFirstPlayerController()->GetPawn())) { - return; + PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController()); } - else + //Set to UI Mode Only + APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); + PlayerController->SetInputMode(FInputModeUIOnly()); + PlayerController->bShowMouseCursor = true; + + disableTab = true; + if (ThisCamera != nullptr) { OriginalCameraLocation = ThisCamera->GetComponentLocation(); OriginalCameraRotation = ThisCamera->GetComponentRotation(); OriginalCameraFOV = ThisCamera->FieldOfView; - //ulog the originalcameralocation value UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString()); } } void ATempCharacter::InputEnabler() { - UE_LOG(LogTemp, Display, TEXT("Enabling Inputs")); - GetWorld()->GetFirstPlayerController()->SetIgnoreLookInput(false); - GetWorld()->GetFirstPlayerController()->SetIgnoreMoveInput(false); - 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) + //Enable Character Movement + if (ACharacter* PlayerCharacter = Cast(GetWorld()->GetFirstPlayerController()->GetPawn())) { - return; + PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController()); } - else + //Reset UI Mode + APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); + PlayerController->SetInputMode(FInputModeGameOnly()); + PlayerController->bShowMouseCursor = false; + + UE_LOG(LogTemp, Display, TEXT("Enabling Inputs")); + disableTab = true; + TraceDistance = 300; + if (ThisCamera != nullptr) { ThisCamera->SetWorldLocation(OriginalCameraLocation); ThisCamera->SetWorldRotation(OriginalCameraRotation); ThisCamera->FieldOfView = OriginalCameraFOV; - //ulog the originalcameralocation value UE_LOG(LogTemp, Display, TEXT("Original Camera Location: %s"), *OriginalCameraLocation.ToString()); } } @@ -190,7 +247,7 @@ void ATempCharacter::UseItem(class UBaseItem* Item) if(Item) { Item->Use(this); - Item->OnUse(this); //Blueprint Version + Item->OnUse(this); //OnUse is a Blueprint Version } } diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index 928b8df..57675b2 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -6,7 +6,7 @@ #include "GameFramework/Character.h" #include "the_twilight_abyss/BaseItems/Items/BaseItem.h" #include "Camera/CameraComponent.h" -#include "Kismet/KismetMathLibrary.h" +#include "Engine/PostProcessVolume.h" #include "TempCharacter.generated.h" UCLASS() @@ -25,6 +25,12 @@ protected: void ForwardInput(float Axis); void RightMoveInput(float Axis); + UFUNCTION() + void Sneak(); + + + UCapsuleComponent* PlayerCapsule; + public: // Called every frame virtual void Tick(float DeltaTime) override; @@ -77,5 +83,16 @@ public: void BuyItem(); bool bShopKeeperText = false; - + + UPROPERTY(BlueprintReadWrite) + bool disableTab = false; + + APostProcessVolume* PostProcessVolume; + + TArray AIActors; + + FName Enemy; + + FName Ammo; + }; diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index 5fff2b7..b2c29ff 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -42,17 +42,16 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy) IronResource = 10; SulfurResource = 10; - if (APlayerController* PC = Cast(GetWorld()->GetFirstPlayerController())) - { - PC->bShowMouseCursor = true; - PC->bEnableClickEvents = true; - PC->bEnableMouseOverEvents = true; - } //Disable Character Movement if (ACharacter* PlayerCharacter = Cast(GetWorld()->GetFirstPlayerController()->GetPawn())) { PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController()); } + //Set to UI Mode Only + APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); + PlayerController->SetInputMode(FInputModeUIOnly()); + PlayerController->bShowMouseCursor = true; + CurrentComboString = ""; UpdateComboString(CurrentComboString); RevertActionPoints(); @@ -73,17 +72,10 @@ 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; + //Set to Game Mode Only + APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); + PlayerController->SetInputMode(FInputModeGameOnly()); + PlayerController->bShowMouseCursor = false; } void ATurnBaseCombatV2::FKeyPressed()