Files
open-conflict/Source/OpenConflict/PlayerCharacter/Components/DDIHealth.h
2025-12-05 00:00:56 -05:00

75 lines
2.0 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "HealthSegmentStruct.h"
#include "Components/ActorComponent.h"
#include "DDIHealth.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class OPENCONFLICT_API UDDIHealth : public UActorComponent
{
GENERATED_BODY()
/*UPROPERTY and UFUNCTION declarations*/
private:
/*Properties*/
/*Functions*/
UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable, Category = "Health")
void Heal();
protected:
/*Properties*/
UPROPERTY(BlueprintReadOnly, Category = "Health")
int MaxHealth; //Stores the default max health of component
UPROPERTY(BlueprintReadOnly, Category = "Health")
int CurrentHealth; //Stores the active health of component
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Health")
float HealTickTime; //Time in Seconds between heal ticks
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Health")
float HealDelayTime; //Time in Seconds before heal ticks
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stage")
UDataTable* HealthSegmentTable;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stage")
ClassNames ClassName;
/*Functions*/
UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable, Category = "Health")
void TakeDamage(int DamageValue);
public:
/*Properties*/
/*Functions*/
/*C++ only declarations*/
private:
/*Properties*/
/*Functions*/
protected:
/*Properties*/
TArray<int> HealthSegments;
FTimerHandle HealTimer; // Called to begin healing
// FTimerManager& TimerManager = GetWorld()->GetTimerManager();
/*Functions*/
// Called when the game starts
virtual void BeginPlay() override;
public:
/*Properties*/
/*Functions*/
// Sets default values for this component's properties
UDDIHealth();
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
};