take damage function created. need to decide how damage and health is managed
60 lines
1.3 KiB
C++
60 lines
1.3 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.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*/
|
|
|
|
protected:
|
|
/*Properties*/
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Health")
|
|
float MaxHealth; //Stores the default max health of component
|
|
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Health")
|
|
float CurrentHealth; //Stores the active health of component
|
|
|
|
/*Functions*/
|
|
UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable, Category = "Health")
|
|
void TakeDamage(UDamageType* DamageType);
|
|
|
|
public:
|
|
/*Properties*/
|
|
|
|
/*Functions*/
|
|
|
|
/*C++ only declarations*/
|
|
private:
|
|
/*Properties*/
|
|
|
|
/*Functions*/
|
|
|
|
protected:
|
|
/*Properties*/
|
|
|
|
/*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;
|
|
|
|
};
|