Added Silencer attachment code to all weapons

This commit is contained in:
MH261677 2024-01-12 18:50:53 +00:00
parent 1939f521f8
commit 21cfa4f2c9
2 changed files with 13 additions and 13 deletions

View File

@ -12,6 +12,8 @@
#include "EndlessVendetta/AI/EnemyCharacter.h" #include "EndlessVendetta/AI/EnemyCharacter.h"
#include <EndlessVendetta/EndlessVendettaGameMode.h> #include <EndlessVendetta/EndlessVendettaGameMode.h>
#include "EndlessVendetta/Workbench&Attachments/SilencerAttachmentClass.h"
// Sets default values // Sets default values
ABaseWeaponClass::ABaseWeaponClass() ABaseWeaponClass::ABaseWeaponClass()
@ -251,19 +253,14 @@ void ABaseWeaponClass::InteractPrompt()
WeaponStatsPopUp(); WeaponStatsPopUp();
} }
// void ABaseWeaponClass::GetOutHit(FHitResult OutHit) void ABaseWeaponClass::SetupSilencerAttachment(UStaticMesh* SilencerMesh)
// { {
// if(IsValid(this)) FTransform emptytransform;
// { UActorComponent* SilencerComponent = AddComponentByClass(USilencerAttachmentClass::StaticClass(), true, emptytransform, false);
// endlessVendettaChar->PrimaryWeapon->Destroy(); Cast<USilencerAttachmentClass>(SilencerComponent)->AttachToComponent(RootComponent, FAttachmentTransformRules::SnapToTargetIncludingScale);
// } TArray<UActorComponent*> SilencerMeshSocketArray (GetComponentsByTag(UStaticMeshComponent::StaticClass(), FName("SilencerMeshSocket")));
// if (OutHit.GetActor()->ActorHasTag(FName("AssaultRifle"))) Cast<UStaticMeshComponent>(SilencerMeshSocketArray[0])->SetStaticMesh(SilencerMesh);
// { }
// endlessVendettaChar->EquipPrimary();
// }
// AActor* HitActor = Cast<ABaseWeaponClass>(endlessVendettaChar->PrimaryWeaponClass);
// endlessVendettaChar->PrimaryWeapon = Cast<ABaseWeaponClass>(HitActor);
// }

View File

@ -176,6 +176,9 @@ public:
//void GetOutHit(FHitResult OutHit); //void GetOutHit(FHitResult OutHit);
UFUNCTION(BlueprintCallable)
void SetupSilencerAttachment(UStaticMesh* SilencerMesh);
protected: protected:
UArrowComponent* GunStartArrow; UArrowComponent* GunStartArrow;
bool bStopShooting = false; bool bStopShooting = false;