Add shelter damage placeholder
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "AgrarianPersistentStateProvider.h"
|
||||
#include "AgrarianShelterActor.generated.h"
|
||||
|
||||
class UBoxComponent;
|
||||
@@ -11,13 +12,19 @@ class UAgrarianPersistentActorComponent;
|
||||
class UStaticMeshComponent;
|
||||
|
||||
UCLASS(Blueprintable)
|
||||
class AAgrarianShelterActor : public AActor
|
||||
class AAgrarianShelterActor : public AActor, public IAgrarianPersistentStateProvider
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
AAgrarianShelterActor();
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
virtual float TakeDamage(float DamageAmount, const FDamageEvent& DamageEvent, AController* EventInstigator, AActor* DamageCauser) override;
|
||||
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
|
||||
virtual void CapturePersistentState_Implementation(UAgrarianPersistentActorComponent* PersistentComponent) const override;
|
||||
virtual void ApplyPersistentState_Implementation(UAgrarianPersistentActorComponent* PersistentComponent) override;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Shelter")
|
||||
TObjectPtr<UStaticMeshComponent> Mesh;
|
||||
|
||||
@@ -29,4 +36,37 @@ public:
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Shelter", meta = (ClampMin = "0", ClampMax = "1"))
|
||||
float WeatherProtection = 0.65f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Agrarian|Shelter|Damage", meta = (ClampMin = "1"))
|
||||
float MaxStructureHealth = 100.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing = OnRep_StructureHealth, Category = "Agrarian|Shelter|Damage", meta = (ClampMin = "0"))
|
||||
float CurrentStructureHealth = 100.0f;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Shelter|Damage")
|
||||
bool bCanBeDeconstructed = true;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Shelter|Damage")
|
||||
bool bDestroyWhenHealthDepleted = true;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Agrarian|Shelter|Damage")
|
||||
bool ApplyStructureDamage(float DamageAmount, AActor* DamageCauser);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Agrarian|Shelter|Damage")
|
||||
bool RepairStructure(float RepairAmount);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Agrarian|Shelter|Damage")
|
||||
bool Deconstruct(AActor* RequestingActor);
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Agrarian|Shelter|Damage")
|
||||
float GetStructureHealthRatio() const;
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Agrarian|Shelter|Damage")
|
||||
bool IsStructureDamaged() const;
|
||||
|
||||
protected:
|
||||
UFUNCTION()
|
||||
void OnRep_StructureHealth();
|
||||
|
||||
void ClampStructureHealth();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user