Compare commits
2 Commits
0361eb2c00
...
characterS
| Author | SHA1 | Date | |
|---|---|---|---|
| 20a1478bdc | |||
| d2e1db997d |
38
Source/OpenConflict/PlayerCharacter/Components/DDIHealth.cpp
Normal file
38
Source/OpenConflict/PlayerCharacter/Components/DDIHealth.cpp
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
// Fill out your copyright notice in the Description page of Project Settings.
|
||||||
|
|
||||||
|
|
||||||
|
#include "DDIHealth.h"
|
||||||
|
|
||||||
|
// Sets default values for this component's properties
|
||||||
|
UDDIHealth::UDDIHealth()
|
||||||
|
{
|
||||||
|
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
|
||||||
|
// off to improve performance if you don't need them.
|
||||||
|
PrimaryComponentTick.bCanEverTick = true;
|
||||||
|
MaxHealth = 100;
|
||||||
|
CurrentHealth = 100;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the game starts
|
||||||
|
void UDDIHealth::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
// ...
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Called every frame
|
||||||
|
void UDDIHealth::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
|
||||||
|
{
|
||||||
|
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
||||||
|
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called to cause damage
|
||||||
|
void UDDIHealth::TakeDamage(UDamageType* DamageType)
|
||||||
|
{
|
||||||
|
}
|
||||||
59
Source/OpenConflict/PlayerCharacter/Components/DDIHealth.h
Normal file
59
Source/OpenConflict/PlayerCharacter/Components/DDIHealth.h
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
// 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;
|
||||||
|
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user