tengri/Source/TengriPlatformer/World/Interactive/TengriPickupActor.h

67 lines
1.9 KiB
C++

// Request Games © All rights reserved
// Source/TengriPlatformer/World/TengriPickupActor.cpp
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "TengriPickupActor.generated.h"
class USphereComponent;
class UStaticMeshComponent;
/**
* Base class for all physics pickup items (rocks, bones, keys).
* Handles physics states when held/dropped.
*/
UCLASS()
class TENGRIPLATFORMER_API ATengriPickupActor : public AActor
{
GENERATED_BODY()
public:
ATengriPickupActor();
protected:
virtual void BeginPlay() override;
public:
// ========================================================================
// COMPONENTS
// ========================================================================
/** Visual representation and physics body */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pickup")
TObjectPtr<UStaticMeshComponent> MeshComp;
/** Trigger zone for detection */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Pickup")
TObjectPtr<USphereComponent> TriggerComp;
// ========================================================================
// STATE API
// ========================================================================
/** * Called when character picks up this item.
* Disables physics and collision.
*/
UFUNCTION(BlueprintCallable, Category = "Pickup")
virtual void OnPickedUp(USceneComponent* AttachTo, FName SocketName);
/** * Called when character drops/throws this item.
* Re-enables physics and detaches.
* @param Impulse - Optional force to apply (for throwing)
* @param bVelChange
*/
UFUNCTION(BlueprintCallable, Category = "Pickup")
virtual void OnDropped(FVector Impulse = FVector::ZeroVector, bool bVelChange = false);
/** Check if currently held by someone */
UFUNCTION(BlueprintPure, Category = "Pickup")
bool IsHeld() const { return bIsHeld; }
protected:
bool bIsHeld = false;
};