// 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 { GENERATED_BODY() ARealTimeCombat(); UPROPERTY(EditDefaultsOnly) int PlayerHealth = 100; UPROPERTY(EditDefaultsOnly) int EnemyHealth = 100; UPROPERTY(EditDefaultsOnly) int MaxActionPoints = 3; UPROPERTY(EditDefaultsOnly) int ActiveActionPoints = 0; UPROPERTY(EditDefaultsOnly) int IronResource = 10; // F UPROPERTY(EditDefaultsOnly) int SulfurResource = 10; // W UPROPERTY(VisibleAnywhere) AActor* PlayerActor; UPROPERTY(VisibleAnywhere) AActor* EnemyActor; // AActor* ActiveActor; /* TODO: Reference Player Inventory */ UPROPERTY(EditAnywhere) TSubclassOf HUDWidget; UPROPERTY(EditAnywhere) TMap ValidCombos = { {"F", 10}, {"W", 10}, {"WW", 15}, {"FW", 20}, {"FFW", 30} }; FString BattleLog; UFUNCTION(BlueprintCallable) void StartCombat(); UFUNCTION(BlueprintCallable) void EndCombat(); UFUNCTION(BlueprintCallable) void OnMouseClick(); UFUNCTION(BlueprintCallable) void OnQPress(); UFUNCTION(BlueprintCallable) void OnEPress(); UFUNCTION(BlueprintCallable) void OnBackspacePress(); 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; private: bool IsValidCombo(FString Combo) const; float ActionPointsTimer = 0.0f; int HeldActionPoints = 0; UPROPERTY() 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; 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; };