Updated TurnBaseCombat to Start Combat onCollision
This commit is contained in:
parent
c6e7dbca62
commit
b20004e599
BIN
Content/Blueprints/Combat_UI/TestCombatCharacter.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Combat_UI/TestCombatCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
@ -18,14 +18,9 @@ ATurnBaseCombat::ATurnBaseCombat()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ATurnBaseCombat::BeginPlay()
|
void ATurnBaseCombat::StartCombat()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
if (HUD->IsInViewport()) return;
|
||||||
|
|
||||||
TArray<AActor*> AllCharacterActorsInScene;
|
|
||||||
UGameplayStatics::GetAllActorsOfClassWithTag(GetWorld(), AActor::StaticClass(), FName("Character"), AllCharacterActorsInScene);
|
|
||||||
|
|
||||||
UUserWidget* HUD = CreateWidget<UUserWidget>(GetWorld(), HUDWidget);
|
|
||||||
HUD->AddToViewport();
|
HUD->AddToViewport();
|
||||||
|
|
||||||
APlayerController* PC = Cast<APlayerController>(GetWorld()->GetFirstPlayerController());
|
APlayerController* PC = Cast<APlayerController>(GetWorld()->GetFirstPlayerController());
|
||||||
@ -36,6 +31,22 @@ void ATurnBaseCombat::BeginPlay()
|
|||||||
PC->bEnableClickEvents = true;
|
PC->bEnableClickEvents = true;
|
||||||
PC->bEnableMouseOverEvents = true;
|
PC->bEnableMouseOverEvents = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ATurnBaseCombat::EndCombat()
|
||||||
|
{
|
||||||
|
//Remove the HUD from the viewport
|
||||||
|
HUD->RemoveFromViewport();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ATurnBaseCombat::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
TArray<AActor*> AllCharacterActorsInScene;
|
||||||
|
UGameplayStatics::GetAllActorsOfClassWithTag(GetWorld(), AActor::StaticClass(), FName("Character"), AllCharacterActorsInScene);
|
||||||
|
|
||||||
|
HUD = CreateWidget<UUserWidget>(GetWorld(), HUDWidget);
|
||||||
|
|
||||||
TurnIndicatorTextBlock = Cast<UTextBlock>(HUD->GetWidgetFromName("TurnIndicator"));
|
TurnIndicatorTextBlock = Cast<UTextBlock>(HUD->GetWidgetFromName("TurnIndicator"));
|
||||||
CurrentComboTextBlock = Cast<UTextBlock>(HUD->GetWidgetFromName("CurrentCombo"));
|
CurrentComboTextBlock = Cast<UTextBlock>(HUD->GetWidgetFromName("CurrentCombo"));
|
||||||
|
@ -52,6 +52,11 @@ public:
|
|||||||
|
|
||||||
FString BattleLog;
|
FString BattleLog;
|
||||||
|
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void StartCombat();
|
||||||
|
UFUNCTION(BlueprintCallable)
|
||||||
|
void EndCombat();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
void ExecuteCast(FString Combo);
|
void ExecuteCast(FString Combo);
|
||||||
@ -64,6 +69,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool IsValidCombo(FString Combo) const;
|
bool IsValidCombo(FString Combo) const;
|
||||||
|
UUserWidget* HUD;
|
||||||
|
|
||||||
UPROPERTY(VisibleAnywhere)
|
UPROPERTY(VisibleAnywhere)
|
||||||
bool bIsPlayerTurn = true;
|
bool bIsPlayerTurn = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user