AzureAbyss/Source/the_twilight_abyss/TurnBasedCombatV2/StatusSystem.h

71 lines
1.6 KiB
C
Raw Normal View History

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "StatusEffect.h"
#include "Components/WrapBox.h"
#include "StatusSystem.generated.h"
USTRUCT()
struct FActiveStatusEffect
{
GENERATED_BODY()
UPROPERTY()
float TimeInitiated;
UPROPERTY()
float TimeTillExpiry;
UPROPERTY()
UStatusEffect* StatusEffect;
UPROPERTY()
UUserWidget* StatusIcon;
bool operator==(const FActiveStatusEffect& Comp) const
{
return StatusEffect == Comp.StatusEffect;
}
};
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class THE_TWILIGHT_ABYSS_API UStatusSystem : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UStatusSystem();
UPROPERTY()
TSubclassOf<UUserWidget> HUDStatusIndicatorsWidget;
UPROPERTY()
TSubclassOf<UUserWidget> HUDStatusIconWidget;
UPROPERTY()
UUserWidget* HUDStatusIndicators;
UPROPERTY()
UWrapBox* StatusIconsBox;
UPROPERTY()
TArray<FActiveStatusEffect> ActiveStatusEffects;
protected:
// Called when the game starts
virtual void BeginPlay() override;
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
UFUNCTION()
void AddStatusEffect(UStatusEffect* StatusEffect, float DurationMultiplier = 1.0f);
UFUNCTION()
void RemoveStatusEffect(UStatusEffect* StatusEffect);
UFUNCTION()
FActiveStatusEffect GetActiveStatusEffect(UStatusEffect* StatusEffect);
};