Grip Attachment now lowers recoil for all weapons

This commit is contained in:
MH261677 2024-04-20 16:33:55 +01:00
parent 50605f7d8e
commit f14122caed
6 changed files with 26 additions and 12 deletions

View File

@ -1,2 +0,0 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/Environment/Highlighting/HighlightingSourceSnapshotLocation/@EntryValue">C:\Users\Rafal\AppData\Local\JetBrains\Rider2023.3\resharper-host\temp\Rider\vAny\CoverageData\_EndlessVendetta.-1253833435\Snapshot\snapshot.utdcvr</s:String></wpf:ResourceDictionary>

View File

@ -200,7 +200,7 @@ void ABaseWeaponClass::Fire()
GetWorld()->LineTraceSingleByObjectType(outHit, traceStart, traceEnd, ObjectQueryParams, collisionParams);
WeaponFired.Broadcast();
playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1);
endlessVendettaChar->PawnNoiseEmitterComp->MakeNoise(endlessVendettaChar, 1, traceStart);
endlessVendettaChar->PawnNoiseEmitterComp->MakeNoise(endlessVendettaChar, 1, traceStart); //LITERALLY CHANGE THIS FOR SUPPRESSOR AND IT SHOULD WORK LOL
currentAmmoCount -= 1;
GenerateRecoilVector();
ClickDetectionTimer();

View File

@ -202,6 +202,11 @@ public:
UPROPERTY(BlueprintAssignable, Category = "Weapons")
FWeaponFired WeaponFired;
float originalMinMultiplier;
float originalMagnitude;
float originalMaxAngleLeft;
float originalMaxAngleRight;
protected:
UArrowComponent* GunStartArrow;
bool bStopShooting = false;
@ -209,8 +214,5 @@ protected:
UPROPERTY(VisibleAnywhere)
int tempWeaponDamage;
float originalMagnitude;
float originalMaxAngleLeft;
float originalMaxAngleRight;
float originalMinMultiplier;
};

View File

@ -3,6 +3,8 @@
#include "GripAttachmentClass.h"
#include "EndlessVendetta/WeaponSystem/BaseWeaponClass.h"
// Sets default values for this component's properties
UGripAttachmentClass::UGripAttachmentClass()
@ -19,9 +21,17 @@ UGripAttachmentClass::UGripAttachmentClass()
void UGripAttachmentClass::BeginPlay()
{
Super::BeginPlay();
// ...
BaseWeaponClassRef = Cast<ABaseWeaponClass>(this->GetAttachParentActor());
if(IsValid(BaseWeaponClassRef))
{
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Red, TEXT("GripAttachmentClass called"));
BaseWeaponClassRef->howMnyShotsTillRclStop = 2;
BaseWeaponClassRef->originalMinMultiplier /= 2;
BaseWeaponClassRef->originalMagnitude /= 2;
BaseWeaponClassRef->originalMaxAngleLeft /= 2;
BaseWeaponClassRef->originalMaxAngleRight /= 2;
BaseWeaponClassRef->WeaponScopedFire();
}
}
@ -29,5 +39,6 @@ void UGripAttachmentClass::BeginPlay()
void UGripAttachmentClass::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
}

View File

@ -23,4 +23,7 @@ protected:
public:
// Called every frame
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
UPROPERTY(VisibleAnywhere)
class ABaseWeaponClass* BaseWeaponClassRef;
};