Added Silencer attachment code to all weapons
This commit is contained in:
parent
1939f521f8
commit
21cfa4f2c9
@ -12,6 +12,8 @@
|
||||
#include "EndlessVendetta/AI/EnemyCharacter.h"
|
||||
#include <EndlessVendetta/EndlessVendettaGameMode.h>
|
||||
|
||||
#include "EndlessVendetta/Workbench&Attachments/SilencerAttachmentClass.h"
|
||||
|
||||
|
||||
// Sets default values
|
||||
ABaseWeaponClass::ABaseWeaponClass()
|
||||
@ -251,19 +253,14 @@ void ABaseWeaponClass::InteractPrompt()
|
||||
WeaponStatsPopUp();
|
||||
}
|
||||
|
||||
// void ABaseWeaponClass::GetOutHit(FHitResult OutHit)
|
||||
// {
|
||||
// if(IsValid(this))
|
||||
// {
|
||||
// endlessVendettaChar->PrimaryWeapon->Destroy();
|
||||
// }
|
||||
// if (OutHit.GetActor()->ActorHasTag(FName("AssaultRifle")))
|
||||
// {
|
||||
// endlessVendettaChar->EquipPrimary();
|
||||
// }
|
||||
// AActor* HitActor = Cast<ABaseWeaponClass>(endlessVendettaChar->PrimaryWeaponClass);
|
||||
// endlessVendettaChar->PrimaryWeapon = Cast<ABaseWeaponClass>(HitActor);
|
||||
// }
|
||||
void ABaseWeaponClass::SetupSilencerAttachment(UStaticMesh* SilencerMesh)
|
||||
{
|
||||
FTransform emptytransform;
|
||||
UActorComponent* SilencerComponent = AddComponentByClass(USilencerAttachmentClass::StaticClass(), true, emptytransform, false);
|
||||
Cast<USilencerAttachmentClass>(SilencerComponent)->AttachToComponent(RootComponent, FAttachmentTransformRules::SnapToTargetIncludingScale);
|
||||
TArray<UActorComponent*> SilencerMeshSocketArray (GetComponentsByTag(UStaticMeshComponent::StaticClass(), FName("SilencerMeshSocket")));
|
||||
Cast<UStaticMeshComponent>(SilencerMeshSocketArray[0])->SetStaticMesh(SilencerMesh);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -176,6 +176,9 @@ public:
|
||||
|
||||
//void GetOutHit(FHitResult OutHit);
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void SetupSilencerAttachment(UStaticMesh* SilencerMesh);
|
||||
|
||||
protected:
|
||||
UArrowComponent* GunStartArrow;
|
||||
bool bStopShooting = false;
|
||||
|
Loading…
Reference in New Issue
Block a user