Space Plunder
Loading...
Searching...
No Matches
AWeaponAttachmentPickup Class Reference

Pickup for weapon attachments. More...

#include <WeaponAttachmentPickup.h>

Inheritance diagram for AWeaponAttachmentPickup:
AInteractableActorWithPrompt AInteractableActor AActorBase IBaseInterface ISaveLoad

Public Member Functions

 AWeaponAttachmentPickup (const FObjectInitializer &ObjectInitializer)
 
- Public Member Functions inherited from AInteractableActorWithPrompt
 AInteractableActorWithPrompt ()
 
- Public Member Functions inherited from AInteractableActor
 AInteractableActor ()
 
virtual void ReceiveStartFocus (AActor *Caller)
 
virtual void ReceiveEndFocus (AActor *Caller)
 
virtual void ReceiveOnInteract (AActor *Caller, const EInteractionType InteractionType)
 
virtual void ReceiveOnEndInteract (AActor *Caller)
 
virtual void ReceiveOnOverlap (AActor *Caller)
 
virtual void ReceiveOnEndOverlap (AActor *Caller)
 
virtual void ReceiveToggleSwitch (AActor *Caller, const bool bOn)
 
- Public Member Functions inherited from AActorBase
 AActorBase ()
 
virtual bool SaveGame () override
 
virtual bool LoadGame () override
 
void SetGravityEnabledEvent (const bool bValue)
 

Public Attributes

FString AttachmentPickupID
 

Protected Member Functions

virtual void BeginPlay () override
 
virtual void OnInteract (AActor *Caller, const int32 SelectedInteraction) override
 
virtual void InteractionComplete () override
 
virtual void OnEndInteract (AActor *Caller) override
 
virtual bool OnOverlap (AActor *Caller) override
 
virtual void StartFocus () override
 
virtual void EndFocus () override
 
virtual void ToggleSwitch (AActor *Caller, bool bOn) override
 
virtual FVector GetInteractionLocation () const override
 
virtual UPrimitiveComponent * GetGrabComponent () const override
 
- Protected Member Functions inherited from AInteractableActorWithPrompt
void OnInteractionComplete (AActor *Caller)
 
void HideButtonPrompt ()
 
- Protected Member Functions inherited from AInteractableActor
virtual void Tick (float DeltaTime) override
 
virtual void SetMeshOutline (const bool bValue)
 
- Protected Member Functions inherited from AActorBase
void LogDebugError (const FString &Message) const
 
void LogDebugError (const FString &Message, const int32 Value) const
 
void LogDebugError (const FString &Message, const float Value) const
 
void LogDebugWarning (const FString &Message) const
 
void LogDebugWarning (const FString &Message, const int32 Value) const
 
void LogDebugWarning (const FString &Message, const float Value) const
 
void LogDebugMessage (const FString &Message, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const int32 Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const float Value, const bool bWarning=false, const bool bError=false) const
 
void LogDebugMessage (const FString &Message, const bool bValue, const bool bWarning, const bool bError) const
 
void LogOnScreenMessage (const int32 Key, const FString &Message, FColor Color=FColor::Green) const
 
void SetCategoryName (const FLogCategoryBase &Category)
 

Protected Attributes

class UStaticMeshComponent * AttachmentMesh
 
class UCapsuleComponent * CapsuleComponent
 
- Protected Attributes inherited from AInteractableActorWithPrompt
class UInteractionPromptComponent * InteractionPromptComponent
 
class USphereComponent * InteractionPromptCollision
 
class USceneComponent * SceneRootComponent
 
bool bHasProgress = true
 
float PromptHeight = 75.0f
 
AActor * CurrentInteractCaller = nullptr
 
float HidePromptTime = 2.5f
 
- Protected Attributes inherited from AInteractableActor
class UInteractableActorComponent * InteractableActorComponent
 
class UAudioReactionComponent * AudioReactionComponent
 
class UAIPerceptionStimuliSourceComponent * PerceptionStimuliComponent
 
- Protected Attributes inherited from AActorBase
FString DisplayName = "Display Name"
 
bool bDebuggingMode = false
 

Private Member Functions

void SetMesh () const
 

Private Attributes

FWeaponAttachment AttachmentPickupData
 

Detailed Description

Pickup for weapon attachments.

This class inherits from AInteractableActorWithPrompt and provides functionality specific to weapon attachment pickups.

Constructor & Destructor Documentation

◆ AWeaponAttachmentPickup()

AWeaponAttachmentPickup::AWeaponAttachmentPickup ( const FObjectInitializer & ObjectInitializer)
15 : Super(ObjectInitializer.DoNotCreateDefaultSubobject(TEXT("Scene Root")))
16{
17 bReplicates = true;
18 SetReplicatingMovement(true);
19 AttachmentMesh = CreateDefaultSubobject<UStaticMeshComponent>("Attachment Mesh");
20 AttachmentMesh->SetGenerateOverlapEvents(true);
21 AttachmentMesh->SetCollisionProfileName(TEXT("DefaultPickup"));
22 AttachmentMesh->SetSimulatePhysics(true);
23 AttachmentMesh->SetRenderCustomDepth(true);
24 RootComponent = AttachmentMesh;
25 AttachmentMesh->bRenderCustomDepth = false;
26
27 CapsuleComponent = CreateDefaultSubobject<UCapsuleComponent>("Capsule Component");
28 CapsuleComponent->SetupAttachment(AttachmentMesh);
29 CapsuleComponent->SetWorldRotation(FRotator(0,0,90));
30 FWalkableSlopeOverride WalkableSlopeOverride;
31 WalkableSlopeOverride.WalkableSlopeBehavior = EWalkableSlopeBehavior::WalkableSlope_Unwalkable;
32 CapsuleComponent->SetWalkableSlopeOverride(WalkableSlopeOverride);
33
37
38}
class USphereComponent * InteractionPromptCollision
Definition InteractableActorWithPrompt.h:32
class UInteractionPromptComponent * InteractionPromptComponent
Definition InteractableActorWithPrompt.h:29
class UStaticMeshComponent * AttachmentMesh
Definition WeaponAttachmentPickup.h:35
class UCapsuleComponent * CapsuleComponent
Definition WeaponAttachmentPickup.h:37
Definition BaseData.h:420

Member Function Documentation

◆ BeginPlay()

void AWeaponAttachmentPickup::BeginPlay ( )
overrideprotectedvirtual

Reimplemented from AInteractableActorWithPrompt.

41{
42 Super::BeginPlay();
43 bool bSuccess = false;
45 if(!bSuccess)
46 {
47 UE_LOG(LogWeaponSystem, Error, TEXT("Attachment FAiled to Create"));
48 Destroy();
49 }
51 SetMesh();
52
53}
FString DisplayName
Definition ActorBase.h:51
void SetMesh() const
Definition WeaponAttachmentPickup.cpp:56
FWeaponAttachment AttachmentPickupData
Definition WeaponAttachmentPickup.h:52
FString AttachmentPickupID
Definition WeaponAttachmentPickup.h:28
static FWeaponAttachment GetWeaponAttachment(const UObject *WorldContextObject, const FString &WeaponAttachmentID, bool &bSuccess, UDataTable *DataTable=nullptr)
Definition WeaponBPLib.cpp:235
FName AttachmentTypeName() const
Definition WeaponStructs.h:544

◆ EndFocus()

void AWeaponAttachmentPickup::EndFocus ( )
overrideprotectedvirtual
129{
130 Super::EndFocus();
131 if(AttachmentMesh != nullptr)
132 {
133 AttachmentMesh->SetRenderCustomDepth(false);
134 }
135}

◆ GetGrabComponent()

virtual UPrimitiveComponent * AWeaponAttachmentPickup::GetGrabComponent ( ) const
inlineoverrideprotectedvirtual
48{return Cast<UPrimitiveComponent>(RootComponent);};

◆ GetInteractionLocation()

FVector AWeaponAttachmentPickup::GetInteractionLocation ( ) const
overrideprotectedvirtual
143{
144 return Super::GetInteractionLocation();
145}

◆ InteractionComplete()

void AWeaponAttachmentPickup::InteractionComplete ( )
overrideprotectedvirtual

Reimplemented from AInteractableActorWithPrompt.

90{
91 Super::InteractionComplete();
92 if(CurrentInteractCaller == nullptr){return;}
93 ICharacterWeaponPickups* CharacterInteracting = Cast<ICharacterWeaponPickups>(CurrentInteractCaller);
94 IBaseServer* ServerCharacterInteracting = Cast<IBaseServer>(CurrentInteractCaller);
95 if(CharacterInteracting != nullptr)
96 {
97 CharacterInteracting->PickupAttachmentEvent(AttachmentPickupID);
98 if(ServerCharacterInteracting != nullptr)
99 {
100 ServerCharacterInteracting->DestroyActor(this);
101 }
102 }
103}
AActor * CurrentInteractCaller
Definition InteractableActorWithPrompt.h:60
Definition BaseServer.h:16
virtual void DestroyActor(AActor *ActorToDestroy)
Definition CharacterWeaponPickups.h:17
virtual void PickupAttachmentEvent(const FString &WeaponAttachmentID)=0

◆ OnEndInteract()

void AWeaponAttachmentPickup::OnEndInteract ( AActor * Caller)
overrideprotectedvirtual
106{
107 Super::OnEndInteract(Caller);
108 if(InteractionPromptComponent != nullptr)
109 {
110 InteractionPromptComponent->SetAvailable();
111 }
112}

◆ OnInteract()

void AWeaponAttachmentPickup::OnInteract ( AActor * Caller,
const int32 SelectedInteraction )
overrideprotectedvirtual
65{
66 ICharacterWeaponPickups* CharacterInteracting = Cast<ICharacterWeaponPickups>(Caller);
67 if(CharacterInteracting == nullptr){return;}
68 if(!AttachmentPickupData.IsValid()){return;}
69
70 SetOwner(Caller);
71 const bool bCanPickup = CharacterInteracting->PickupAttachmentCheck(AttachmentPickupData);
72 if(bCanPickup)
73 {
74 if(InteractionPromptComponent != nullptr)
75 {
76 InteractionPromptComponent->SetAvailable();
77 }
78 Super::OnInteract(Caller, SelectedInteraction);
79 }
80 else
81 {
82 if(InteractionPromptComponent != nullptr)
83 {
84 InteractionPromptComponent->SetUnavailable();
85 }
86 }
87}
virtual bool PickupAttachmentCheck(const FWeaponAttachment &In_WeaponAttachmentData)=0
bool IsValid() const
Definition WeaponStructs.h:531

◆ OnOverlap()

bool AWeaponAttachmentPickup::OnOverlap ( AActor * Caller)
overrideprotectedvirtual
115{
116 return Super::OnOverlap(Caller);
117}

◆ SetMesh()

void AWeaponAttachmentPickup::SetMesh ( ) const
private
57{
58 if(AttachmentPickupData.StaticMesh != nullptr && AttachmentMesh != nullptr)
59 {
61 }
62}
class UStaticMesh * StaticMesh
Definition WeaponStructs.h:507

◆ StartFocus()

void AWeaponAttachmentPickup::StartFocus ( )
overrideprotectedvirtual
120{
121 Super::StartFocus();
122 if(AttachmentMesh != nullptr)
123 {
124 AttachmentMesh->SetRenderCustomDepth(true);
125 }
126}

◆ ToggleSwitch()

void AWeaponAttachmentPickup::ToggleSwitch ( AActor * Caller,
bool bOn )
overrideprotectedvirtual
138{
139 Super::ToggleSwitch(Caller, bOn);
140}

Member Data Documentation

◆ AttachmentMesh

class UStaticMeshComponent* AWeaponAttachmentPickup::AttachmentMesh
protected

◆ AttachmentPickupData

FWeaponAttachment AWeaponAttachmentPickup::AttachmentPickupData
private

◆ AttachmentPickupID

FString AWeaponAttachmentPickup::AttachmentPickupID

◆ CapsuleComponent

class UCapsuleComponent* AWeaponAttachmentPickup::CapsuleComponent
protected

The documentation for this class was generated from the following files: