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();
|
||||
|
||||
TArray<AActor*> AllCharacterActorsInScene;
|
||||
UGameplayStatics::GetAllActorsOfClassWithTag(GetWorld(), AActor::StaticClass(), FName("Character"), AllCharacterActorsInScene);
|
||||
|
||||
UUserWidget* HUD = CreateWidget<UUserWidget>(GetWorld(), HUDWidget);
|
||||
if (HUD->IsInViewport()) return;
|
||||
HUD->AddToViewport();
|
||||
|
||||
APlayerController* PC = Cast<APlayerController>(GetWorld()->GetFirstPlayerController());
|
||||
@ -36,6 +31,22 @@ void ATurnBaseCombat::BeginPlay()
|
||||
PC->bEnableClickEvents = 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"));
|
||||
CurrentComboTextBlock = Cast<UTextBlock>(HUD->GetWidgetFromName("CurrentCombo"));
|
||||
|
@ -52,6 +52,11 @@ public:
|
||||
|
||||
FString BattleLog;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void StartCombat();
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void EndCombat();
|
||||
|
||||
protected:
|
||||
virtual void BeginPlay() override;
|
||||
void ExecuteCast(FString Combo);
|
||||
@ -64,6 +69,7 @@ protected:
|
||||
|
||||
private:
|
||||
bool IsValidCombo(FString Combo) const;
|
||||
UUserWidget* HUD;
|
||||
|
||||
UPROPERTY(VisibleAnywhere)
|
||||
bool bIsPlayerTurn = true;
|
||||
|
Loading…
Reference in New Issue
Block a user