157 lines
3.1 KiB
C++
157 lines
3.1 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Components/Button.h"
|
|
#include "Components/ProgressBar.h"
|
|
#include "Components/TextBlock.h"
|
|
#include "NiagaraComponent.h"
|
|
#include "NiagaraFunctionLibrary.h"
|
|
#include "GameFramework/GameStateBase.h"
|
|
#include "TurnBaseCombatV2.generated.h"
|
|
|
|
class UNiagaraSystem;
|
|
|
|
UCLASS()
|
|
class THE_TWILIGHT_ABYSS_API ATurnBaseCombatV2 : public AGameStateBase
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
ATurnBaseCombatV2();
|
|
|
|
int* EnemyHealth = nullptr;
|
|
float* PlayerHealth = nullptr;
|
|
UPROPERTY(EditDefaultsOnly)
|
|
int DefaultActionPoints = 3;
|
|
UPROPERTY(EditDefaultsOnly)
|
|
int ActiveActionPoints = 0;
|
|
UPROPERTY(EditDefaultsOnly)
|
|
int IronResource = 10; // F
|
|
UPROPERTY(EditDefaultsOnly)
|
|
int SulfurResource = 10; // W
|
|
|
|
UPROPERTY(EditDefaultsOnly)
|
|
UNiagaraSystem* GunEffect;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
AActor* PlayerActor;
|
|
UPROPERTY(VisibleAnywhere)
|
|
AActor* EnemyActor;
|
|
// AActor* ActiveActor;
|
|
UPROPERTY(BlueprintReadWrite)
|
|
UUserWidget* HUD;
|
|
/*
|
|
TODO:
|
|
Reference Player Inventory
|
|
*/
|
|
UPROPERTY(EditAnywhere)
|
|
TSubclassOf<UUserWidget> HUDWidget;
|
|
UPROPERTY(EditAnywhere)
|
|
TMap<FString, int32> ValidCombos =
|
|
{
|
|
{"F", 10},
|
|
{"W", 10},
|
|
{"WW", 15},
|
|
{"FW", 20},
|
|
{"FFW", 30}
|
|
};
|
|
|
|
FString BattleLog;
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
void StartCombat(AActor* Enemy);
|
|
UFUNCTION(BlueprintCallable)
|
|
void EndCombat();
|
|
UFUNCTION(BlueprintCallable)
|
|
void FKeyPressed();
|
|
UFUNCTION(BlueprintCallable)
|
|
void WKeyPressed();
|
|
|
|
protected:
|
|
virtual void BeginPlay() override;
|
|
void ExecuteCast(FString Combo);
|
|
void UseActionPoint();
|
|
void ReuseActionPoint();
|
|
void RevertActionPoints();
|
|
void DamagePlayer(int Damage);
|
|
void DamageEnemy(int Damage);
|
|
void UpdateProgressBars() const;
|
|
|
|
private:
|
|
bool IsValidCombo(FString Combo) const;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
bool bIsPlayerTurn = true;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
FString CurrentComboString = "";
|
|
|
|
void SwitchTurn();
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UTextBlock* TurnIndicatorTextBlock;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UTextBlock* CurrentComboTextBlock;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UTextBlock* BattleLogTextBlock;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UTextBlock* ActionPointsTextBlock;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UProgressBar* PlayerHealthBar;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UProgressBar* EnemyHealthBar;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UProgressBar* IronResourceBar;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UProgressBar* SulfurResourceBar;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UButton* CastButton;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UButton* FButton;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UButton* WButton;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UButton* BackspaceButton;
|
|
|
|
UPROPERTY(VisibleAnywhere)
|
|
UButton* RunButton;
|
|
|
|
UFUNCTION()
|
|
void CastButtonOnClick();
|
|
|
|
UFUNCTION()
|
|
void FButtonOnClick();
|
|
|
|
UFUNCTION()
|
|
void WButtonOnClick();
|
|
|
|
UFUNCTION()
|
|
void BackspaceButtonOnClick();
|
|
|
|
UFUNCTION()
|
|
void RunButtonOnClick();
|
|
|
|
void UpdateComboString(FString NewCombo) const;
|
|
void UpdateActionPoints() const;
|
|
|
|
void AddBattleLogMessage(FString Message);
|
|
void ClearBattleLog();
|
|
void UpdateBattleLog();
|
|
void UpdateResourceBars() const;
|
|
void ToggleButtons() const;
|
|
void EnemyTurn();
|
|
};
|