Files
PHY/Plugins/GIS/Source/GenericInventorySystem/Public/Pickups/GIS_PickupComponent.h
2026-03-03 01:23:02 +08:00

70 lines
2.1 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Copyright 2025 https://yuewu.dev/en All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "GIS_PickupComponent.generated.h"
class UGIS_InventorySystemComponent;
/**
* Delegate triggered when a pickup action succeeds or fails.
* 拾取动作成功或失败时触发的委托。
*/
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGIS_PickupSignature);
/**
* Base component for handling pickup logic in the inventory system.
* 库存系统中处理拾取逻辑的基组件。
* @details Provides the core functionality for picking up items, currencies, or inventories.
* @细节 提供拾取道具、货币或库存的核心功能。
*/
UCLASS(Abstract, Blueprintable, BlueprintType)
class GENERICINVENTORYSYSTEM_API UGIS_PickupComponent : public UActorComponent
{
GENERATED_BODY()
public:
/**
* Constructor for the pickup component.
* 拾取组件的构造函数。
*/
UGIS_PickupComponent();
/**
* Performs the pickup logic, typically called during interaction.
* 执行拾取逻辑,通常在交互时调用。
* @param Picker The inventory system component of the actor performing the pickup. 执行拾取的演员的库存系统组件。
* @return True if the pickup was successful, false otherwise. 如果拾取成功则返回true否则返回false。
*/
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category="GIS|Pickup")
virtual bool Pickup(UGIS_InventorySystemComponent* Picker);
/**
* Delegate triggered when the pickup action succeeds.
* 拾取动作成功时触发的委托。
*/
UPROPERTY(BlueprintAssignable, Category="Pickup")
FGIS_PickupSignature OnPickupSuccess;
/**
* Delegate triggered when the pickup action fails.
* 拾取动作失败时触发的委托。
*/
UPROPERTY(BlueprintAssignable, Category="Pickup")
FGIS_PickupSignature OnPickupFail;
protected:
/**
* Notifies listeners of a successful pickup.
* 通知监听者拾取成功。
*/
virtual void NotifyPickupSuccess();
/**
* Notifies listeners of a failed pickup.
* 通知监听者拾取失败。
*/
virtual void NotifyPickupFailed();
};