From 18ceedfa03079992646c57e4f057aec7b7ab63b0 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Mon, 24 Apr 2023 18:01:51 +0100 Subject: [PATCH 1/7] Updated Character to Convert Screen Space to World for Interaction --- Content/Blueprints/Combat_UI/BookCombat_UI.uasset | 4 ++-- Content/Blueprints/Combat_UI/BookWorldWidget.uasset | 4 ++-- Content/Blueprints/Combat_UI/CombatCharacter.uasset | 4 ++-- Content/Blueprints/Combat_UI/CombatTutorial.uasset | 4 ++-- .../the_twilight_abyss/PlayerTemp/TempCharacter.cpp | 11 +++++++++++ Source/the_twilight_abyss/PlayerTemp/TempCharacter.h | 8 ++++++++ .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 6 +++++- .../TurnBasedCombatV2/TurnBaseCombatV2.h | 2 ++ 8 files changed, 34 insertions(+), 9 deletions(-) diff --git a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset index b5dd3bc..2a821b7 100644 --- a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset +++ b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24239f11123eae1d8dfb8b8c91123a03047dd09ca6f9dc374f22257fe05209ad -size 79303 +oid sha256:5300666477d0304bccf1ca8e12806a2d06ce5e1d3337076b921735b4245aa2a0 +size 91639 diff --git a/Content/Blueprints/Combat_UI/BookWorldWidget.uasset b/Content/Blueprints/Combat_UI/BookWorldWidget.uasset index 27542e5..218e2d7 100644 --- a/Content/Blueprints/Combat_UI/BookWorldWidget.uasset +++ b/Content/Blueprints/Combat_UI/BookWorldWidget.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:df5d8b3aeb9cd7bcbe0d78c90f2a7278f6133c89b58600fee8e8f7b63f7dcbda -size 23477 +oid sha256:6aea2b49abbfdd1ac0da1147e3419e5f6410fa4e940075c7e56262d90c703fb2 +size 23653 diff --git a/Content/Blueprints/Combat_UI/CombatCharacter.uasset b/Content/Blueprints/Combat_UI/CombatCharacter.uasset index d1994e4..da92e03 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:7f5c422149980fd84aae6d5e3c93acb836034a66de360907cfedbc5b9384ce77 -size 129743 +oid sha256:2324577c80acdf9a2bad2b0923dabf42f580b80b6e391aa2f44aeaf528b57fe5 +size 131883 diff --git a/Content/Blueprints/Combat_UI/CombatTutorial.uasset b/Content/Blueprints/Combat_UI/CombatTutorial.uasset index 4d5595b..72bdb4a 100644 --- a/Content/Blueprints/Combat_UI/CombatTutorial.uasset +++ b/Content/Blueprints/Combat_UI/CombatTutorial.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:105769fa75c92ede5d6755984d7e6ab2bb8a06f64de788b296dd59752966dab7 -size 59828 +oid sha256:4b4aab87269ca504b3c501ffc37ba58bcffa14975659fa61a31239fc365a0f1d +size 59827 diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index b2aeee5..c102921 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -28,6 +28,10 @@ ATempCharacter::ATempCharacter() void ATempCharacter::BeginPlay() { Super::BeginPlay(); + + FirstPlayerController = GetWorld()->GetFirstPlayerController(); + WidgetPointer = Cast(this->GetComponentByClass(UWidgetInteractionComponent::StaticClass())); + Health = 100; ThisCamera = Cast(this->FindComponentByClass()); PlayerCapsule = GetCapsuleComponent(); @@ -93,6 +97,13 @@ void ATempCharacter::Sneak() void ATempCharacter::Tick(float DeltaTime) { Super::Tick(DeltaTime); + if (CombatSystem->bIsInCombat) + { + FVector VectorRotation; + FVector WidgetLocation; + FirstPlayerController->DeprojectMousePositionToWorld(WidgetLocation, VectorRotation); + WidgetPointer->SetWorldLocationAndRotation(WidgetLocation, VectorRotation.Rotation().Quaternion()); + } } // Gives the character the functionality diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index 64b95b0..06d50f0 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -7,6 +7,8 @@ #include "the_twilight_abyss/BaseItems/Items/BaseItem.h" #include "Camera/CameraComponent.h" #include "Engine/PostProcessVolume.h" +#include "Components/WidgetInteractionComponent.h" +#include "../TurnBasedCombatV2/TurnBaseCombatV2.h" #include "TempCharacter.generated.h" UCLASS() @@ -29,6 +31,12 @@ protected: void Sneak(); UCapsuleComponent* PlayerCapsule; + UPROPERTY() + APlayerController* FirstPlayerController; + UPROPERTY() + UWidgetInteractionComponent* WidgetPointer; + UPROPERTY() + ATurnBaseCombatV2* CombatSystem; public: // Called every frame diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index 4e257fb..bd39e85 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -36,6 +36,7 @@ ATurnBaseCombatV2::ATurnBaseCombatV2() void ATurnBaseCombatV2::StartCombat(AActor* Enemy) { if (Enemy == nullptr) return; + bIsInCombat = true; UBlackboardComponent* EnemyBlackboard = Cast(Enemy->GetInstigatorController())->GetBlackboardComponent(); if (!HasSeenTutorial) { @@ -62,7 +63,7 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy) } if (HUD->IsInViewport()) return; - HUD->AddToViewport(); + //HUD->AddToViewport(); EnemyActor = Enemy; ProbertiumResource = 10; @@ -77,6 +78,7 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy) } //Set to UI Mode Only APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); + PlayerController->SetInputMode(FInputModeUIOnly()); PlayerController->bShowMouseCursor = true; @@ -100,6 +102,7 @@ void ATurnBaseCombatV2::EndCombat() { bEnemyHasExtraTurn = false; bPlayerHasExtraTurn = false; + bIsInCombat = false; for (UStatusEffect* StatusEffect : StatusEffects) { StatusEffect->OnExpiry(PlayerActor); @@ -516,3 +519,4 @@ void ATurnBaseCombatV2::EnemyTurn() TurnIndicatorTextBlock->SetText(FText::FromString("Player Turn")); ToggleButtons(); } + diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h index 7a9ca72..962c0f6 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h @@ -26,6 +26,8 @@ public: int* EnemyHealth = nullptr; float* PlayerHealth = nullptr; + bool bIsInCombat = false; + UPROPERTY(EditDefaultsOnly) int DefaultActionPoints = 2; UPROPERTY(EditDefaultsOnly) From 34e5c78bf1cbee0d4e439d512f85cf19a396ce72 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Mon, 24 Apr 2023 23:25:10 +0100 Subject: [PATCH 2/7] Updated Combat to Centre Cursor --- .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index bd39e85..1b7fd56 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -36,6 +36,8 @@ ATurnBaseCombatV2::ATurnBaseCombatV2() void ATurnBaseCombatV2::StartCombat(AActor* Enemy) { if (Enemy == nullptr) return; + const FVector2D ViewportSize = FVector2D(GEngine->GameViewport->Viewport->GetSizeXY()); + GetWorld()->GetFirstPlayerController()->SetMouseLocation(ViewportSize.X / 2, ViewportSize.Y / 2); bIsInCombat = true; UBlackboardComponent* EnemyBlackboard = Cast(Enemy->GetInstigatorController())->GetBlackboardComponent(); if (!HasSeenTutorial) @@ -100,6 +102,8 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy) void ATurnBaseCombatV2::EndCombat() { + const FVector2D ViewportSize = FVector2D(GEngine->GameViewport->Viewport->GetSizeXY()); + GetWorld()->GetFirstPlayerController()->SetMouseLocation(ViewportSize.X / 2, ViewportSize.Y / 2); bEnemyHasExtraTurn = false; bPlayerHasExtraTurn = false; bIsInCombat = false; @@ -126,6 +130,8 @@ void ATurnBaseCombatV2::EndCombat() void ATurnBaseCombatV2::BeginPlay() { Super::BeginPlay(); + const FVector2D ViewportSize = FVector2D(GEngine->GameViewport->Viewport->GetSizeXY()); + GetWorld()->GetFirstPlayerController()->SetMouseLocation(ViewportSize.X / 2, ViewportSize.Y / 2); TArray AllCharacterActorsInScene; @@ -303,7 +309,6 @@ void ATurnBaseCombatV2::DamageEnemy(int Damage, FString DamageType) void ATurnBaseCombatV2::UpdateProgressBars() const { - //PlayerHealthBar->SetPercent(*PlayerHealth / 100.0f); EnemyHealthBar->SetPercent(*EnemyHealth / 100.0f); } @@ -519,4 +524,3 @@ void ATurnBaseCombatV2::EnemyTurn() TurnIndicatorTextBlock->SetText(FText::FromString("Player Turn")); ToggleButtons(); } - From eb43c252afd762c0c7a087ea0c80d980a541a115 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 25 Apr 2023 01:07:35 +0100 Subject: [PATCH 3/7] Updated BookUI to Include Element Icons --- Content/Blueprints/Combat_UI/BookCombat_UI.uasset | 4 ++-- Content/Blueprints/Combat_UI/Iconage/Azos.uasset | 3 +++ Content/Blueprints/Combat_UI/Iconage/AzosFaded.uasset | 3 +++ Content/Blueprints/Combat_UI/Iconage/Eis.uasset | 3 +++ Content/Blueprints/Combat_UI/Iconage/EisFaded.uasset | 3 +++ Content/Blueprints/Combat_UI/Iconage/Iroquoiod.uasset | 3 +++ Content/Blueprints/Combat_UI/Iconage/IroquoiodFaded.uasset | 3 +++ Content/Blueprints/Combat_UI/Iconage/Probertium.uasset | 3 +++ Content/Blueprints/Combat_UI/Iconage/ProbertiumFaded.uasset | 3 +++ Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp | 1 + UI designs/Azos.png | 3 +++ UI designs/AzosFaded.png | 3 +++ UI designs/Eis.png | 3 +++ UI designs/EisFaded.png | 3 +++ UI designs/Iroquoiod.png | 3 +++ UI designs/IroquoiodFaded.png | 3 +++ UI designs/Probertium.png | 3 +++ UI designs/ProbertiumFaded.png | 3 +++ 18 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 Content/Blueprints/Combat_UI/Iconage/Azos.uasset create mode 100644 Content/Blueprints/Combat_UI/Iconage/AzosFaded.uasset create mode 100644 Content/Blueprints/Combat_UI/Iconage/Eis.uasset create mode 100644 Content/Blueprints/Combat_UI/Iconage/EisFaded.uasset create mode 100644 Content/Blueprints/Combat_UI/Iconage/Iroquoiod.uasset create mode 100644 Content/Blueprints/Combat_UI/Iconage/IroquoiodFaded.uasset create mode 100644 Content/Blueprints/Combat_UI/Iconage/Probertium.uasset create mode 100644 Content/Blueprints/Combat_UI/Iconage/ProbertiumFaded.uasset create mode 100644 UI designs/Azos.png create mode 100644 UI designs/AzosFaded.png create mode 100644 UI designs/Eis.png create mode 100644 UI designs/EisFaded.png create mode 100644 UI designs/Iroquoiod.png create mode 100644 UI designs/IroquoiodFaded.png create mode 100644 UI designs/Probertium.png create mode 100644 UI designs/ProbertiumFaded.png diff --git a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset index 2a821b7..20aed5b 100644 --- a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset +++ b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5300666477d0304bccf1ca8e12806a2d06ce5e1d3337076b921735b4245aa2a0 -size 91639 +oid sha256:40975a8c63df41fdd07b72950247d5360884f3bd233133e5071fe6c641d70c5b +size 96013 diff --git a/Content/Blueprints/Combat_UI/Iconage/Azos.uasset b/Content/Blueprints/Combat_UI/Iconage/Azos.uasset new file mode 100644 index 0000000..15c5951 --- /dev/null +++ b/Content/Blueprints/Combat_UI/Iconage/Azos.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbc7ec8eebbbe5a4510d594c44b5d60fe75e8f2755260d6489ea4bcef620487e +size 51542 diff --git a/Content/Blueprints/Combat_UI/Iconage/AzosFaded.uasset b/Content/Blueprints/Combat_UI/Iconage/AzosFaded.uasset new file mode 100644 index 0000000..d4e2518 --- /dev/null +++ b/Content/Blueprints/Combat_UI/Iconage/AzosFaded.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2753b2d690f598012b71906b61ce6070108c5fd33db7ce4a93d7c19a3e877421 +size 51626 diff --git a/Content/Blueprints/Combat_UI/Iconage/Eis.uasset b/Content/Blueprints/Combat_UI/Iconage/Eis.uasset new file mode 100644 index 0000000..73b4b3d --- /dev/null +++ b/Content/Blueprints/Combat_UI/Iconage/Eis.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a2af69a87cb6bcbfd24b3f74cfa38a4495431c1c7cd0653ecc66af2f08648336 +size 20913 diff --git a/Content/Blueprints/Combat_UI/Iconage/EisFaded.uasset b/Content/Blueprints/Combat_UI/Iconage/EisFaded.uasset new file mode 100644 index 0000000..1fc04eb --- /dev/null +++ b/Content/Blueprints/Combat_UI/Iconage/EisFaded.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d05f70b9fd9ba35fdbe10f06a7c6047985eb25f4ff58a02807495c6f70e1bf7 +size 21039 diff --git a/Content/Blueprints/Combat_UI/Iconage/Iroquoiod.uasset b/Content/Blueprints/Combat_UI/Iconage/Iroquoiod.uasset new file mode 100644 index 0000000..82f2cf7 --- /dev/null +++ b/Content/Blueprints/Combat_UI/Iconage/Iroquoiod.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d9b79cdf172aac833002bb0107b62310132e5ded15e0e14a9f261b8409754f1 +size 16172 diff --git a/Content/Blueprints/Combat_UI/Iconage/IroquoiodFaded.uasset b/Content/Blueprints/Combat_UI/Iconage/IroquoiodFaded.uasset new file mode 100644 index 0000000..32c88b7 --- /dev/null +++ b/Content/Blueprints/Combat_UI/Iconage/IroquoiodFaded.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2aeceb1033a4930416bccbbe5836f3e58a425274547c9c7061bf81815efed2f5 +size 16307 diff --git a/Content/Blueprints/Combat_UI/Iconage/Probertium.uasset b/Content/Blueprints/Combat_UI/Iconage/Probertium.uasset new file mode 100644 index 0000000..326c853 --- /dev/null +++ b/Content/Blueprints/Combat_UI/Iconage/Probertium.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:559724e9580bfa816c04993927f741ec273e2fc942d010c1548deef27c81d92e +size 20793 diff --git a/Content/Blueprints/Combat_UI/Iconage/ProbertiumFaded.uasset b/Content/Blueprints/Combat_UI/Iconage/ProbertiumFaded.uasset new file mode 100644 index 0000000..a953e82 --- /dev/null +++ b/Content/Blueprints/Combat_UI/Iconage/ProbertiumFaded.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c7afc4a259dd9d5d0ffec713ba7dc793a07ac07383b6945b2558ba0e5366c9c0 +size 20956 diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index c102921..08a54d2 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -30,6 +30,7 @@ void ATempCharacter::BeginPlay() Super::BeginPlay(); FirstPlayerController = GetWorld()->GetFirstPlayerController(); + CombatSystem = Cast(GetWorld()->GetGameState()); WidgetPointer = Cast(this->GetComponentByClass(UWidgetInteractionComponent::StaticClass())); Health = 100; diff --git a/UI designs/Azos.png b/UI designs/Azos.png new file mode 100644 index 0000000..bade5d3 --- /dev/null +++ b/UI designs/Azos.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab5d483fbe8e218573a01c985b82b2a595f14a3643b7836d7c5bf077834323e1 +size 43662 diff --git a/UI designs/AzosFaded.png b/UI designs/AzosFaded.png new file mode 100644 index 0000000..c9ce54f --- /dev/null +++ b/UI designs/AzosFaded.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ce9e6430edff0a38d0147e4f9b4ff3859cba663d3604b7831cc79b02c210aa9 +size 42815 diff --git a/UI designs/Eis.png b/UI designs/Eis.png new file mode 100644 index 0000000..cbe5085 --- /dev/null +++ b/UI designs/Eis.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e18e8da691b960930785dc5e7af06484f0ee09742ce846623e4c1ab65a1a07c3 +size 12742 diff --git a/UI designs/EisFaded.png b/UI designs/EisFaded.png new file mode 100644 index 0000000..28b1b61 --- /dev/null +++ b/UI designs/EisFaded.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b6103ecfc19ccf78e42aabb487db7634d1b5fa8b526875c481f23b20aae15379 +size 12748 diff --git a/UI designs/Iroquoiod.png b/UI designs/Iroquoiod.png new file mode 100644 index 0000000..e04b2c4 --- /dev/null +++ b/UI designs/Iroquoiod.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa564adcf610e7486299554c9b76e034ca1bd63cbda8d00318380cbebffcc789 +size 8960 diff --git a/UI designs/IroquoiodFaded.png b/UI designs/IroquoiodFaded.png new file mode 100644 index 0000000..a8fad44 --- /dev/null +++ b/UI designs/IroquoiodFaded.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5387df2e66294db9136ca8277b56d932daadd9d44b00949ce0d19c87cb699665 +size 8993 diff --git a/UI designs/Probertium.png b/UI designs/Probertium.png new file mode 100644 index 0000000..f056f6c --- /dev/null +++ b/UI designs/Probertium.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:530875cd87268209ed016b421144eec89e903eab0cc1b8779b49057b806b5b03 +size 12707 diff --git a/UI designs/ProbertiumFaded.png b/UI designs/ProbertiumFaded.png new file mode 100644 index 0000000..9b1fc86 --- /dev/null +++ b/UI designs/ProbertiumFaded.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c9008bfe34070a91aa0a22420fa5abfcea83ff6e395dbef97f5dc80a0c58a16f +size 12753 From e7121dbb49e2ebe7c79afc80cd6f9954ab1d1270 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 25 Apr 2023 01:08:26 +0100 Subject: [PATCH 4/7] Updated BookUI to Include Escape Button & Percent --- Content/Blueprints/Combat_UI/BookCombat_UI.uasset | 4 ++-- Content/Blueprints/Combat_UI/Iconage/Escape.uasset | 3 +++ Content/Blueprints/Combat_UI/Iconage/EscapeFaded.uasset | 3 +++ UI designs/Escape.png | 3 +++ UI designs/EscapeFaded.png | 3 +++ 5 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 Content/Blueprints/Combat_UI/Iconage/Escape.uasset create mode 100644 Content/Blueprints/Combat_UI/Iconage/EscapeFaded.uasset create mode 100644 UI designs/Escape.png create mode 100644 UI designs/EscapeFaded.png diff --git a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset index 20aed5b..d446565 100644 --- a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset +++ b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:40975a8c63df41fdd07b72950247d5360884f3bd233133e5071fe6c641d70c5b -size 96013 +oid sha256:3942ada2e5d066e3b540e84d497a27174d0d4d12e6035235fa922ad071c34c6d +size 103340 diff --git a/Content/Blueprints/Combat_UI/Iconage/Escape.uasset b/Content/Blueprints/Combat_UI/Iconage/Escape.uasset new file mode 100644 index 0000000..4803a12 --- /dev/null +++ b/Content/Blueprints/Combat_UI/Iconage/Escape.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:255965f068b104100e1ca50ab88c54bd2cc850306c77c71d94ff8f2d6019524a +size 17995 diff --git a/Content/Blueprints/Combat_UI/Iconage/EscapeFaded.uasset b/Content/Blueprints/Combat_UI/Iconage/EscapeFaded.uasset new file mode 100644 index 0000000..bfe629e --- /dev/null +++ b/Content/Blueprints/Combat_UI/Iconage/EscapeFaded.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:49d3256b98e61b2cee2d8f69b039cb74dcaa27fed29bda626a77aad5d9ac0ab9 +size 20400 diff --git a/UI designs/Escape.png b/UI designs/Escape.png new file mode 100644 index 0000000..3746191 --- /dev/null +++ b/UI designs/Escape.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d9934d979939b25df21a5f48731a7e0c1cecfb999a988375b786eb062842ab5 +size 11786 diff --git a/UI designs/EscapeFaded.png b/UI designs/EscapeFaded.png new file mode 100644 index 0000000..4a0a456 --- /dev/null +++ b/UI designs/EscapeFaded.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fdc93f3819c3e80e98478f771cb7c4170951d9150a17a780a4fb60e78b10a462 +size 12424 From d0eaf37de796ed20bba4f8477881c7b1234b78f7 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 25 Apr 2023 01:13:04 +0100 Subject: [PATCH 5/7] Updated BookUI for Icon Positioning --- Content/Blueprints/Combat_UI/BookCombat_UI.uasset | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset index d446565..008b2d8 100644 --- a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset +++ b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3942ada2e5d066e3b540e84d497a27174d0d4d12e6035235fa922ad071c34c6d -size 103340 +oid sha256:af6df165486accabe06ae7afae04790ba557aa04842343a9b6791952b08bd747 +size 105696 From 32e65e3f47faa1af0b9630510df7c542d2ff01bf Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 25 Apr 2023 03:46:52 +0100 Subject: [PATCH 6/7] Updated BookUI for Cast & Clear Buttons --- Config/DefaultInput.ini | 2 +- .../Blueprints/Combat_UI/BookCombat_UI.uasset | 4 +- .../Combat_UI/CombatCharacter.uasset | 4 +- .../__RealTime/CombatCharacterRT.uasset | 3 - .../Combat_UI/__RealTime/Combat_UI_RT.uasset | 3 - .../__RealTime/RealTimeCombatTest.uasset | 3 - .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 91 +++++++++++-------- 7 files changed, 60 insertions(+), 50 deletions(-) delete mode 100644 Content/Blueprints/Combat_UI/__RealTime/CombatCharacterRT.uasset delete mode 100644 Content/Blueprints/Combat_UI/__RealTime/Combat_UI_RT.uasset delete mode 100644 Content/Blueprints/Combat_UI/__RealTime/RealTimeCombatTest.uasset diff --git a/Config/DefaultInput.ini b/Config/DefaultInput.ini index 8698439..73b2f08 100644 --- a/Config/DefaultInput.ini +++ b/Config/DefaultInput.ini @@ -81,7 +81,7 @@ DoubleClickTime=0.200000 +ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_FaceButton_Bottom) +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="Click",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) diff --git a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset index 008b2d8..8e99704 100644 --- a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset +++ b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:af6df165486accabe06ae7afae04790ba557aa04842343a9b6791952b08bd747 -size 105696 +oid sha256:ecfd07e9b330ccfe419588e7b9709078aef64367f41368bea4f52c5d310bb5fb +size 117245 diff --git a/Content/Blueprints/Combat_UI/CombatCharacter.uasset b/Content/Blueprints/Combat_UI/CombatCharacter.uasset index da92e03..bdcc2d3 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:2324577c80acdf9a2bad2b0923dabf42f580b80b6e391aa2f44aeaf528b57fe5 -size 131883 +oid sha256:2288fc028031dde43dddc963534df07aabf9d878a4c0f0ae4c7bd2bc88b9be16 +size 142363 diff --git a/Content/Blueprints/Combat_UI/__RealTime/CombatCharacterRT.uasset b/Content/Blueprints/Combat_UI/__RealTime/CombatCharacterRT.uasset deleted file mode 100644 index d1d4ede..0000000 --- a/Content/Blueprints/Combat_UI/__RealTime/CombatCharacterRT.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fc9eb13d6d72b8b0ed0e1ffa48c052e1a6d579087fd566fd400dbe2b4d9636f8 -size 79436 diff --git a/Content/Blueprints/Combat_UI/__RealTime/Combat_UI_RT.uasset b/Content/Blueprints/Combat_UI/__RealTime/Combat_UI_RT.uasset deleted file mode 100644 index 4e9640d..0000000 --- a/Content/Blueprints/Combat_UI/__RealTime/Combat_UI_RT.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8dfba51c1e874efc1e3d3d04fb94601fde10f98bde12c05080fd5461107d74f3 -size 46237 diff --git a/Content/Blueprints/Combat_UI/__RealTime/RealTimeCombatTest.uasset b/Content/Blueprints/Combat_UI/__RealTime/RealTimeCombatTest.uasset deleted file mode 100644 index d573236..0000000 --- a/Content/Blueprints/Combat_UI/__RealTime/RealTimeCombatTest.uasset +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8eea345343389a3c9c52ae3ff4f51e0b8c0d2083650e05e1596db4d065ec42ae -size 29452 diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index 1b7fd56..58cd163 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -9,7 +9,6 @@ #include "BehaviorTree/BlackboardComponent.h" #include "Components/TextBlock.h" #include "Components/ProgressBar.h" -#include "GameFramework/Character.h" #include "Kismet/GameplayStatics.h" #include "the_twilight_abyss/PlayerTemp/TempCharacter.h" @@ -36,6 +35,7 @@ ATurnBaseCombatV2::ATurnBaseCombatV2() void ATurnBaseCombatV2::StartCombat(AActor* Enemy) { if (Enemy == nullptr) return; + if (bIsInCombat) return; const FVector2D ViewportSize = FVector2D(GEngine->GameViewport->Viewport->GetSizeXY()); GetWorld()->GetFirstPlayerController()->SetMouseLocation(ViewportSize.X / 2, ViewportSize.Y / 2); bIsInCombat = true; @@ -74,14 +74,10 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy) IroquoidResource = 10; //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->SetIgnoreMoveInput(true); + PlayerController->SetIgnoreLookInput(true); + PlayerController->SetInputMode(FInputModeGameAndUI()); PlayerController->bShowMouseCursor = true; FVector Direction = Enemy->GetActorLocation() - PlayerActor->GetActorLocation(); @@ -117,12 +113,10 @@ void ATurnBaseCombatV2::EndCombat() PlayerPawn->bUseControllerRotationYaw = true; PlayerPawn->bUseControllerRotationPitch = true; //Enable Character Movement - if (ACharacter* PlayerCharacter = Cast(GetWorld()->GetFirstPlayerController()->GetPawn())) - { - PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController()); - } //Set to Game Mode Only APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); + PlayerController->SetIgnoreMoveInput(false); + PlayerController->SetIgnoreLookInput(false); PlayerController->SetInputMode(FInputModeGameOnly()); PlayerController->bShowMouseCursor = false; } @@ -160,13 +154,13 @@ void ATurnBaseCombatV2::BeginPlay() EisResourceBar = Cast(BookHUD->GetWidgetFromName("EisResourceBar")); AzosResourceBar = Cast(BookHUD->GetWidgetFromName("AzosResourceBar")); IroquoidResourceBar = Cast(BookHUD->GetWidgetFromName("IroquoidResourceBar")); - CastButton = Cast(HUD->GetWidgetFromName("CastButton")); - PButton = Cast(HUD->GetWidgetFromName("PButton")); - EButton = Cast(HUD->GetWidgetFromName("EButton")); - AButton = Cast(HUD->GetWidgetFromName("AButton")); - IButton = Cast(HUD->GetWidgetFromName("IButton")); - BackspaceButton = Cast(HUD->GetWidgetFromName("BackspaceButton")); - RunButton = Cast(HUD->GetWidgetFromName("RunButton")); + CastButton = Cast(BookHUD->GetWidgetFromName("Cast_Button")); + PButton = Cast(BookHUD->GetWidgetFromName("Probertium_Button")); + EButton = Cast(BookHUD->GetWidgetFromName("Eis_Button")); + AButton = Cast(BookHUD->GetWidgetFromName("Azos_Button")); + IButton = Cast(BookHUD->GetWidgetFromName("Iroquoid_Button")); + BackspaceButton = Cast(BookHUD->GetWidgetFromName("Clear_Button")); + RunButton = Cast(BookHUD->GetWidgetFromName("Escape_Button")); CastButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::CastButtonOnClick); PButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::PButtonOnClick); EButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::EButtonOnClick); @@ -226,7 +220,7 @@ void ATurnBaseCombatV2::ExecuteCast(FString Combo) } } - if (GunEffect) + if (GunEffect && !bIsInCombat) { const UStaticMeshComponent* GunComponent = Cast(PlayerActor->GetComponentsByTag(UPrimitiveComponent::StaticClass(), FName("Gun"))[0]); const FVector GunLocationOffset = GunComponent->GetSocketTransform("Muzzle").TransformPosition(FVector(-100, 0, 0)); @@ -418,31 +412,56 @@ void ATurnBaseCombatV2::IButtonOnClick() void ATurnBaseCombatV2::BackspaceButtonOnClick() { + if (CurrentComboString.Len() <= 0) { GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Blank Combo")); return; } - ReuseActionPoint(); - if (CurrentComboString.Right(1) == "P") + for (int i = 0; i < CurrentComboString.Len(); i++) { - ProbertiumResource += 1; + if (CurrentComboString[i] == 'P') + { + ProbertiumResource += 1; + } + else if (CurrentComboString[i] == 'E') + { + EisResource += 1; + } + else if (CurrentComboString[i] == 'A') + { + AzosResource += 1; + } + else if (CurrentComboString[i] == 'I') + { + IroquoidResource += 1; + } } - else if (CurrentComboString.Right(1) == "E") - { - EisResource += 1; - } - else if (CurrentComboString.Right(1) == "A") - { - AzosResource += 1; - } - else if (CurrentComboString.Right(1) == "I") - { - IroquoidResource += 1; - } - CurrentComboString.RemoveAt(CurrentComboString.Len() - 1); + CurrentComboString = ""; UpdateComboString(CurrentComboString); + RevertActionPoints(); + UpdateActionPoints(); UpdateResourceBars(); + // ReuseActionPoint(); + // if (CurrentComboString.Right(1) == "P") + // { + // ProbertiumResource += 1; + // } + // else if (CurrentComboString.Right(1) == "E") + // { + // EisResource += 1; + // } + // else if (CurrentComboString.Right(1) == "A") + // { + // AzosResource += 1; + // } + // else if (CurrentComboString.Right(1) == "I") + // { + // IroquoidResource += 1; + // } + // CurrentComboString.RemoveAt(CurrentComboString.Len() - 1); + // UpdateComboString(CurrentComboString); + // UpdateResourceBars(); } void ATurnBaseCombatV2::RunButtonOnClick() From cf2a198c3e2df0aaa6a76627625db10f3bf34fff Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 25 Apr 2023 04:23:51 +0100 Subject: [PATCH 7/7] Updated BookUI to Display Turn State and Escape Percentage --- .../Blueprints/Combat_UI/BookCombat_UI.uasset | 4 ++-- .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 21 ++++++++++++++++--- .../TurnBasedCombatV2/TurnBaseCombatV2.h | 5 +++++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset index 8e99704..769cd4f 100644 --- a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset +++ b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ecfd07e9b330ccfe419588e7b9709078aef64367f41368bea4f52c5d310bb5fb -size 117245 +oid sha256:0030dacfde336e729232b84b34bfa39e6b12baeeadedf973edcccfdbcf27d672 +size 120732 diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index 58cd163..ae699e5 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -36,6 +36,8 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy) { if (Enemy == nullptr) return; if (bIsInCombat) return; + EscapePercentage = CalculateEscapePercentage(); + EscapePercentageTextBlock->SetText(FText::Join(FText::FromString(""), FText::FromString(FString::FromInt(EscapePercentage * 100)), FText::FromString("%"))); const FVector2D ViewportSize = FVector2D(GEngine->GameViewport->Viewport->GetSizeXY()); GetWorld()->GetFirstPlayerController()->SetMouseLocation(ViewportSize.X / 2, ViewportSize.Y / 2); bIsInCombat = true; @@ -99,6 +101,7 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy) void ATurnBaseCombatV2::EndCombat() { const FVector2D ViewportSize = FVector2D(GEngine->GameViewport->Viewport->GetSizeXY()); + TurnIndicatorTextBlock->SetText(FText::FromString("")); GetWorld()->GetFirstPlayerController()->SetMouseLocation(ViewportSize.X / 2, ViewportSize.Y / 2); bEnemyHasExtraTurn = false; bPlayerHasExtraTurn = false; @@ -143,11 +146,12 @@ void ATurnBaseCombatV2::BeginPlay() PlayerWidget->InitWidget(); BookHUD = PlayerWidget->GetWidget(); - TurnIndicatorTextBlock = Cast(HUD->GetWidgetFromName("TurnIndicator")); + TurnIndicatorTextBlock = Cast(BookHUD->GetWidgetFromName("TurnIndicator")); CurrentComboTextBlock = Cast(BookHUD->GetWidgetFromName("CurrentCombo")); CurrentComboTextBlock1 = Cast(BookHUD->GetWidgetFromName("CurrentCombo_1")); CurrentComboTextBlock2 = Cast(BookHUD->GetWidgetFromName("CurrentCombo_2")); BattleLogTextBlock = Cast(HUD->GetWidgetFromName("BattleLog")); + EscapePercentageTextBlock = Cast(BookHUD->GetWidgetFromName("EscapePercentage_Text")); PlayerHealthBar = Cast(BookHUD->GetWidgetFromName("PlayerHealthBar")); EnemyHealthBar = Cast(HUD->GetWidgetFromName("EnemyHealthBar")); ProbertiumResourceBar = Cast(BookHUD->GetWidgetFromName("ProbertiumResourceBar")); @@ -306,6 +310,11 @@ void ATurnBaseCombatV2::UpdateProgressBars() const EnemyHealthBar->SetPercent(*EnemyHealth / 100.0f); } +float ATurnBaseCombatV2::CalculateEscapePercentage() const +{ + return FMath::RandRange(0.1f, 0.9f); +} + bool ATurnBaseCombatV2::IsValidCombo(const FString Combo) const { return ValidCombos.Contains(Combo); @@ -412,7 +421,6 @@ void ATurnBaseCombatV2::IButtonOnClick() void ATurnBaseCombatV2::BackspaceButtonOnClick() { - if (CurrentComboString.Len() <= 0) { GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Blank Combo")); @@ -466,8 +474,15 @@ void ATurnBaseCombatV2::BackspaceButtonOnClick() void ATurnBaseCombatV2::RunButtonOnClick() { + if (FMath::RandRange(0.0f, 1.0f) >= EscapePercentage) + { + EscapePercentage = CalculateEscapePercentage(); + EscapePercentageTextBlock->SetText(FText::Join(FText::FromString(""), FText::FromString(FString::FromInt(EscapePercentage * 100)), FText::FromString("%"))); + SwitchTurn(); + return; + } UBlackboardComponent* EnemyBlackboard = Cast(EnemyActor->GetInstigatorController())->GetBlackboardComponent(); - + EscapePercentageTextBlock->SetText(FText::Join(FText::FromString(""), FText::FromString("--"), FText::FromString("%"))); EnemyBlackboard->SetValueAsBool("IsInCombat", false); EnemyBlackboard->SetValueAsBool("WasInCombat", true); EndCombat(); diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h index 962c0f6..cc3446e 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h @@ -128,6 +128,9 @@ protected: bool bPlayerHasExtraTurn = false; bool bEnemyHasExtraTurn = false; + float EscapePercentage = 0.0f; + float CalculateEscapePercentage() const; + private: bool IsValidCombo(FString Combo) const; bool IsSpecialCombo(FString Combo) const; @@ -158,6 +161,8 @@ private: UTextBlock* CurrentComboTextBlock2; UPROPERTY(VisibleAnywhere) UTextBlock* BattleLogTextBlock; + UPROPERTY(VisibleAnywhere) + UTextBlock* EscapePercentageTextBlock; UPROPERTY(VisibleAnywhere) UProgressBar* PlayerHealthBar;