Updated Character to Convert Screen Space to World for Interaction
This commit is contained in:
parent
3e34ab4c5c
commit
18ceedfa03
BIN
Content/Blueprints/Combat_UI/BookCombat_UI.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Combat_UI/BookCombat_UI.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Combat_UI/BookWorldWidget.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Combat_UI/BookWorldWidget.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Combat_UI/CombatCharacter.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Combat_UI/CombatCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Combat_UI/CombatTutorial.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Combat_UI/CombatTutorial.uasset
(Stored with Git LFS)
Binary file not shown.
@ -28,6 +28,10 @@ ATempCharacter::ATempCharacter()
|
|||||||
void ATempCharacter::BeginPlay()
|
void ATempCharacter::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
FirstPlayerController = GetWorld()->GetFirstPlayerController();
|
||||||
|
WidgetPointer = Cast<UWidgetInteractionComponent>(this->GetComponentByClass(UWidgetInteractionComponent::StaticClass()));
|
||||||
|
|
||||||
Health = 100;
|
Health = 100;
|
||||||
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
|
ThisCamera = Cast<UCameraComponent>(this->FindComponentByClass<UCameraComponent>());
|
||||||
PlayerCapsule = GetCapsuleComponent();
|
PlayerCapsule = GetCapsuleComponent();
|
||||||
@ -93,6 +97,13 @@ void ATempCharacter::Sneak()
|
|||||||
void ATempCharacter::Tick(float DeltaTime)
|
void ATempCharacter::Tick(float DeltaTime)
|
||||||
{
|
{
|
||||||
Super::Tick(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
|
// Gives the character the functionality
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include "the_twilight_abyss/BaseItems/Items/BaseItem.h"
|
#include "the_twilight_abyss/BaseItems/Items/BaseItem.h"
|
||||||
#include "Camera/CameraComponent.h"
|
#include "Camera/CameraComponent.h"
|
||||||
#include "Engine/PostProcessVolume.h"
|
#include "Engine/PostProcessVolume.h"
|
||||||
|
#include "Components/WidgetInteractionComponent.h"
|
||||||
|
#include "../TurnBasedCombatV2/TurnBaseCombatV2.h"
|
||||||
#include "TempCharacter.generated.h"
|
#include "TempCharacter.generated.h"
|
||||||
|
|
||||||
UCLASS()
|
UCLASS()
|
||||||
@ -29,6 +31,12 @@ protected:
|
|||||||
void Sneak();
|
void Sneak();
|
||||||
|
|
||||||
UCapsuleComponent* PlayerCapsule;
|
UCapsuleComponent* PlayerCapsule;
|
||||||
|
UPROPERTY()
|
||||||
|
APlayerController* FirstPlayerController;
|
||||||
|
UPROPERTY()
|
||||||
|
UWidgetInteractionComponent* WidgetPointer;
|
||||||
|
UPROPERTY()
|
||||||
|
ATurnBaseCombatV2* CombatSystem;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Called every frame
|
// Called every frame
|
||||||
|
@ -36,6 +36,7 @@ ATurnBaseCombatV2::ATurnBaseCombatV2()
|
|||||||
void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
|
void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
|
||||||
{
|
{
|
||||||
if (Enemy == nullptr) return;
|
if (Enemy == nullptr) return;
|
||||||
|
bIsInCombat = true;
|
||||||
UBlackboardComponent* EnemyBlackboard = Cast<AAIController>(Enemy->GetInstigatorController())->GetBlackboardComponent();
|
UBlackboardComponent* EnemyBlackboard = Cast<AAIController>(Enemy->GetInstigatorController())->GetBlackboardComponent();
|
||||||
if (!HasSeenTutorial)
|
if (!HasSeenTutorial)
|
||||||
{
|
{
|
||||||
@ -62,7 +63,7 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (HUD->IsInViewport()) return;
|
if (HUD->IsInViewport()) return;
|
||||||
HUD->AddToViewport();
|
//HUD->AddToViewport();
|
||||||
EnemyActor = Enemy;
|
EnemyActor = Enemy;
|
||||||
|
|
||||||
ProbertiumResource = 10;
|
ProbertiumResource = 10;
|
||||||
@ -77,6 +78,7 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
|
|||||||
}
|
}
|
||||||
//Set to UI Mode Only
|
//Set to UI Mode Only
|
||||||
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
||||||
|
|
||||||
PlayerController->SetInputMode(FInputModeUIOnly());
|
PlayerController->SetInputMode(FInputModeUIOnly());
|
||||||
PlayerController->bShowMouseCursor = true;
|
PlayerController->bShowMouseCursor = true;
|
||||||
|
|
||||||
@ -100,6 +102,7 @@ void ATurnBaseCombatV2::EndCombat()
|
|||||||
{
|
{
|
||||||
bEnemyHasExtraTurn = false;
|
bEnemyHasExtraTurn = false;
|
||||||
bPlayerHasExtraTurn = false;
|
bPlayerHasExtraTurn = false;
|
||||||
|
bIsInCombat = false;
|
||||||
for (UStatusEffect* StatusEffect : StatusEffects)
|
for (UStatusEffect* StatusEffect : StatusEffects)
|
||||||
{
|
{
|
||||||
StatusEffect->OnExpiry(PlayerActor);
|
StatusEffect->OnExpiry(PlayerActor);
|
||||||
@ -516,3 +519,4 @@ void ATurnBaseCombatV2::EnemyTurn()
|
|||||||
TurnIndicatorTextBlock->SetText(FText::FromString("Player Turn"));
|
TurnIndicatorTextBlock->SetText(FText::FromString("Player Turn"));
|
||||||
ToggleButtons();
|
ToggleButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ public:
|
|||||||
|
|
||||||
int* EnemyHealth = nullptr;
|
int* EnemyHealth = nullptr;
|
||||||
float* PlayerHealth = nullptr;
|
float* PlayerHealth = nullptr;
|
||||||
|
bool bIsInCombat = false;
|
||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly)
|
UPROPERTY(EditDefaultsOnly)
|
||||||
int DefaultActionPoints = 2;
|
int DefaultActionPoints = 2;
|
||||||
UPROPERTY(EditDefaultsOnly)
|
UPROPERTY(EditDefaultsOnly)
|
||||||
|
Loading…
Reference in New Issue
Block a user