AzureAbyss/Source/the_twilight_abyss/RealTimeCombat/RealTimeCombat.h

128 lines
2.7 KiB
C
Raw Normal View History

2022-11-17 03:47:20 +00:00
// 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 "GameFramework/GameStateBase.h"
#include "RealTimeCombat.generated.h"
UCLASS()
class THE_TWILIGHT_ABYSS_API ARealTimeCombat : public AGameStateBase
2022-11-17 03:47:20 +00:00
{
GENERATED_BODY()
ARealTimeCombat();
UPROPERTY(EditDefaultsOnly)
int PlayerHealth = 100;
UPROPERTY(EditDefaultsOnly)
int EnemyHealth = 100;
UPROPERTY(EditDefaultsOnly)
int MaxActionPoints = 3;
2022-11-17 03:47:20 +00:00
UPROPERTY(EditDefaultsOnly)
int ActiveActionPoints = 0;
UPROPERTY(EditDefaultsOnly)
int IronResource = 10; // F
UPROPERTY(EditDefaultsOnly)
int SulfurResource = 10; // W
UPROPERTY(VisibleAnywhere)
AActor* PlayerActor;
2022-11-17 03:47:20 +00:00
UPROPERTY(VisibleAnywhere)
AActor* EnemyActor;
// AActor* ActiveActor;
/*
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();
2022-11-17 03:47:20 +00:00
UFUNCTION(BlueprintCallable)
void EndCombat();
UFUNCTION(BlueprintCallable)
void OnMouseClick();
UFUNCTION(BlueprintCallable)
void OnQPress();
UFUNCTION(BlueprintCallable)
void OnEPress();
UFUNCTION(BlueprintCallable)
void OnBackspacePress();
2022-11-17 03:47:20 +00:00
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;
virtual void Tick(float DeltaSeconds) override;
2022-11-17 03:47:20 +00:00
private:
bool IsValidCombo(FString Combo) const;
float ActionPointsTimer = 0.0f;
int HeldActionPoints = 0;
UPROPERTY()
2022-11-17 03:47:20 +00:00
UUserWidget* HUD;
UPROPERTY(VisibleAnywhere)
bool bIsPlayerTurn = true;
UPROPERTY(VisibleAnywhere)
FString CurrentComboString = "";
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)
UProgressBar* ActionPointsBar;
2022-11-17 03:47:20 +00:00
void UpdateComboString(FString NewCombo) const;
void UpdateActionPoints() const;
void AddBattleLogMessage(FString Message);
void ClearBattleLog();
void UpdateBattleLog();
void UpdateResourceBars() const;
bool HitEnemy() const;
bool bStartTimer = false;
2022-11-17 03:47:20 +00:00
};