FLimenItemBase_PickUpState
Overview
This struct holds information about the controller and pawn that interacted with the item, as well as whether the item is currently dropped. It is used to manage the pick-up and drop events of an ALimenItemBase.
Properties
Type | Name | Access | Description |
|---|---|---|---|
TObjectPtr | InController | Public | The controller that interacted with the item. |
TObjectPtr | InPawn | Public | The pawn that interacted with the item. |
bool | bIsDropped | Public | Indicates whether the item is currently dropped. |
ALimenItemBase
Overview
This class represents a base item that can be interacted with and managed within an inventory system. It handles pick-up and drop events, manages item actions, and provides basic properties like display name, description, and quantity.
Properties
Type | Name | Access | Description | |
|---|---|---|---|---|
FDropStateChange | OnPickedUp | Public | Event triggered when the item is picked up. | |
FDropStateChange | OnDropped | Public | Event triggered when the item is dropped. | |
float | PickupAnimationTime | EditDefaultsOnly, Category=" Limen " | Duration of the pick-up animation. | |
TArray<TSubclassOf< ULimenItemAction >> | ItemActionsClass | EditDefaultsOnly, Category=" Limen | Item Actions" | List of action classes associated with this item. |
int32 | ItemQuantity | EditAnywhere, BlueprintReadOnly, Category="Item Parameters", meta=(ClampMin="1") | Quantity of the item. | |
FText | DisplayName | EditAnywhere, BlueprintReadOnly, Category="Item Parameters" | Display name of the item. | |
FText | Description | EditAnywhere, BlueprintReadOnly, Category="Item Parameters" | Description of the item. | |
TObjectPtr | ItemImage | EditAnywhere, BlueprintReadOnly, Category="Item Parameters" | Image associated with the item. | |
FLimenItemBase_PickUpState | PickUpState | ReplicatedUsing=OnRep_PickUpState | State of the item when it is picked up or dropped. |
Functions
Return Type | Signature | Description |
|---|---|---|
UStaticMeshComponent* | GetStaticMesh() const | Returns the static mesh component of the item. |
USkeletalMeshComponent* | GetSkeletalMesh() const | Returns the skeletal mesh component of the item. |
UMeshComponent* | GetMesh() const | Returns the mesh component of the item, preferring static mesh if available. |
bool | IsDropped() const | Checks if the item is currently dropped. |
void | PickUp(AController* InController, APawn* InPawn) | Handles the pick-up event for the item. |
void | Drop(AController* InController, APawn* InPawn) | Handles the drop event for the item. |
void | SetItemQuantity(const int32 InItemQuantity) | Sets the quantity of the item. |
Usage & Implementation Notes
Threading Constraints: This class is designed to be used in a multi-threaded environment, with replication handled by Unreal Engine's networking system.
Replication Requirements: The
PickUpStateproperty is replicated using theOnRep_PickUpStatefunction to ensure that all clients are aware of the item's state when it changes.Memory Lifetime Management: The
ItemActionsarray manages the lifetime of associated actions, ensuring they are properly cleaned up when no longer needed.