45 lines
1.4 KiB
C++
45 lines
1.4 KiB
C++
// Copyright Pacificao. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "GameFramework/Actor.h"
|
|
#include "AgrarianInteractable.h"
|
|
#include "AgrarianTypes.h"
|
|
#include "AgrarianResourceNode.generated.h"
|
|
|
|
class UStaticMeshComponent;
|
|
|
|
UCLASS(Blueprintable)
|
|
class AAgrarianResourceNode : public AActor, public IAgrarianInteractable
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
AAgrarianResourceNode();
|
|
|
|
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
|
|
|
|
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Resource")
|
|
TObjectPtr<UStaticMeshComponent> Mesh;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Resource")
|
|
FAgrarianItemStack YieldItem;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, ReplicatedUsing = OnRep_RemainingHarvests, Category = "Agrarian|Resource", meta = (ClampMin = "0"))
|
|
int32 RemainingHarvests = 5;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Agrarian|Resource", meta = (ClampMin = "1"))
|
|
int32 QuantityPerHarvest = 1;
|
|
|
|
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;
|
|
|
|
protected:
|
|
UFUNCTION()
|
|
void OnRep_RemainingHarvests();
|
|
|
|
void UpdateDepletedState();
|
|
};
|