75 lines
2.5 KiB
C++
75 lines
2.5 KiB
C++
// Copyright Pacificao. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Actor.h"
|
|
#include "AgrarianInteractable.h"
|
|
#include "AgrarianCampfire.generated.h"
|
|
|
|
class UPointLightComponent;
|
|
class UStaticMeshComponent;
|
|
|
|
UCLASS(Blueprintable)
|
|
class AAgrarianCampfire : public AActor, public IAgrarianInteractable
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
AAgrarianCampfire();
|
|
|
|
virtual void Tick(float DeltaSeconds) override;
|
|
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Fire")
|
|
TObjectPtr<UStaticMeshComponent> Mesh;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Fire")
|
|
TObjectPtr<UPointLightComponent> FireLight;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing = OnRep_FireState, Category = "Agrarian|Fire")
|
|
bool bLit = false;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Agrarian|Fire", meta = (ClampMin = "0"))
|
|
float FuelSeconds = 0.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Fire", meta = (ClampMin = "0"))
|
|
float WarmthRadius = 550.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Fire", meta = (ClampMin = "0"))
|
|
float WarmthPerSecond = 0.02f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Agrarian|Fire|Cooking")
|
|
bool bCookingPlaceholderEnabled = true;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Agrarian|Fire|Cooking", meta = (ClampMin = "0"))
|
|
float CookingSecondsRequired = 30.0f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category = "Agrarian|Fire|Cooking", meta = (ClampMin = "0"))
|
|
float CookingProgressSeconds = 0.0f;
|
|
|
|
virtual FText GetInteractionText_Implementation(const AAgrarianGameCharacter* Interactor) const override;
|
|
virtual bool CanInteract_Implementation(const AAgrarianGameCharacter* Interactor) const override;
|
|
virtual void Interact_Implementation(AAgrarianGameCharacter* Interactor) override;
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Agrarian|Fire")
|
|
void AddFuel(float Seconds);
|
|
|
|
UFUNCTION(BlueprintCallable, Category = "Agrarian|Fire")
|
|
void Extinguish();
|
|
|
|
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Agrarian|Fire|Cooking")
|
|
bool CanCook() const;
|
|
|
|
UFUNCTION(BlueprintCallable, BlueprintPure, Category = "Agrarian|Fire|Cooking")
|
|
float GetCookingProgressRatio() const;
|
|
|
|
protected:
|
|
UFUNCTION()
|
|
void OnRep_FireState();
|
|
|
|
void SetLit(bool bNewLit);
|
|
void UpdateVisualState();
|
|
void WarmNearbyCharacters(float DeltaSeconds);
|
|
};
|