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()
|
2022-11-17 04:52:23 +00:00
|
|
|
|
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)
|
2022-11-17 04:16:44 +00:00
|
|
|
|
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
|
|
|
|
|
|
2022-11-21 20:59:29 +00:00
|
|
|
|
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)
|
2022-11-17 04:52:23 +00:00
|
|
|
|
void StartCombat();
|
2022-11-17 03:47:20 +00:00
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
|
|
|
void EndCombat();
|
2022-11-17 04:16:44 +00:00
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
|
|
|
void OnMouseClick();
|
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
|
|
|
void OnQPress();
|
|
|
|
|
UFUNCTION(BlueprintCallable)
|
|
|
|
|
void OnEPress();
|
2022-11-17 04:52:23 +00:00
|
|
|
|
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;
|
2022-11-17 04:16:44 +00:00
|
|
|
|
virtual void Tick(float DeltaSeconds) override;
|
2022-11-17 03:47:20 +00:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool IsValidCombo(FString Combo) const;
|
2022-11-17 04:16:44 +00:00
|
|
|
|
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)
|
2022-11-17 04:16:44 +00:00
|
|
|
|
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;
|
2022-11-21 20:59:29 +00:00
|
|
|
|
bool HitEnemy() const;
|
|
|
|
|
|
|
|
|
|
bool bStartTimer = false;
|
2022-11-17 03:47:20 +00:00
|
|
|
|
};
|