#pragma once #include "CoreMinimal.h" #include "ResourceBasedObjective.h" #include "GatheItemsObjective.generated.h" class UCappedResource; class UCollectableResourceData; UCLASS(Abstract, Blueprintable, ClassGroup=Custom, meta=(BlueprintSpawnableComponent)) class UGatheItemsObjective : public UResourceBasedObjective { GENERATED_BODY() public: protected: UPROPERTY(BlueprintReadWrite, EditAnywhere, meta=(AllowPrivateAccess=true)) int32 ItemsRequired; UPROPERTY(BlueprintReadWrite, EditAnywhere, meta=(AllowPrivateAccess=true)) float ItemsSpawnedModifier; UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, ReplicatedUsing=OnRep_ItemsCollected, meta=(AllowPrivateAccess=true)) int32 ItemsCollected; UPROPERTY(BlueprintReadWrite, EditAnywhere, meta=(AllowPrivateAccess=true)) UCollectableResourceData* ItemResource; public: UGatheItemsObjective(); virtual void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; protected: UFUNCTION(BlueprintCallable) void OnResourceChanged(UCappedResource* CappedResource, float Amount); UFUNCTION(BlueprintCallable) void OnRep_ItemsCollected(int32 prevAmount); };