#pragma once #include "CoreMinimal.h" #include "Components/ActorComponent.h" #include "EquippedActorData.h" #include "InventoryBase.generated.h" class AActor; UCLASS(Blueprintable, ClassGroup=Custom, meta=(BlueprintSpawnableComponent)) class UInventoryBase : public UActorComponent { GENERATED_BODY() public: private: UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, ReplicatedUsing=OnRep_ActorsSelectable, meta=(AllowPrivateAccess=true)) TArray ActorsSelectable; UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, ReplicatedUsing=OnRep_ActorsNonSelectable, meta=(AllowPrivateAccess=true)) TArray ActorsNonSelectable; UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, ReplicatedUsing=OnRep_EquippedActor, meta=(AllowPrivateAccess=true)) FEquippedActorData EquippedActor; UPROPERTY(EditAnywhere, meta=(AllowPrivateAccess=true)) AActor* LastEquippedActors[2]; public: UInventoryBase(); virtual void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; private: UFUNCTION(BlueprintCallable, Reliable, Server) void Server_SetEquippedActor(const FEquippedActorData& Actor, bool CallClientDelayed); public: UFUNCTION(BlueprintCallable, Reliable, Server) void Server_EquipExternalActor(AActor* Actor); private: UFUNCTION(BlueprintCallable) void OnRep_EquippedActor(FEquippedActorData& OldActor); protected: UFUNCTION(BlueprintCallable) void OnRep_ActorsSelectable(); UFUNCTION(BlueprintCallable) void OnRep_ActorsNonSelectable(); public: UFUNCTION(BlueprintCallable, BlueprintPure) TArray GetSelectableActors() const; UFUNCTION(BlueprintCallable, BlueprintPure) TArray GetAllItems() const; UFUNCTION(BlueprintCallable) void EquipPrevious(); UFUNCTION(BlueprintCallable) void EquipNull(); UFUNCTION(BlueprintCallable) void EquipNext(); UFUNCTION(BlueprintCallable) void EquipLast(); UFUNCTION(BlueprintCallable) void EquipAtIndex(int32 Index, bool ignoreUsing); };