diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset index 4e3a7b0b..2e239e7c 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/AssaultRifles/BP_BaseAssaultRifle.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3194a5d00e86f1294c85008ba95e40c7d09358e3df2d8360945f78a20dc0a78d -size 37917 +oid sha256:d4914d01f2581bf5c3edc200811e9990ccc825755171a4fc83bfb0ef12bcb145 +size 38083 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset index dc2d119d..47d586c9 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_BaseWeapon.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:af36276c4e513a207e06ec1eaa8f5c4273ab5634330a999db47ac9128e7d02ec -size 29776 +oid sha256:4febec5729a36774fbc7932a6fec983a74cc9cfac901f131fcbdafe3da17205c +size 29846 diff --git a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_GunCameraShake.uasset b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_GunCameraShake.uasset index a24df98a..cc04228d 100644 --- a/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_GunCameraShake.uasset +++ b/EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/BP_GunCameraShake.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5b5bc4f06eaeb74c61b627c02ff6e49dedeebfe047bc79fbfa8941b25c4674ef +oid sha256:4358c8520e164b973fae2ae1a18307f0eb691ecfd94b433cbda1052b8b2751fa size 7209 diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp index a8f66c9c..8e61ac7b 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.cpp @@ -75,7 +75,11 @@ void ABaseWeaponClass::GenerateRecoilVector() recoilResultYaw = FMath::Sin(FMath::DegreesToRadians(angle)); recoilResultPitch = FMath::Cos(FMath::DegreesToRadians(angle)); - + + if (bulletCountShoot >= howMnyShotsTillRclStop) + { + recoilResultPitch = 0; + } //scaling direction to magnitude recoilResultPitch *= -tempMag; recoilResultYaw *= tempMag; @@ -92,9 +96,7 @@ void ABaseWeaponClass::ApplyRecoil(float DeltaTime) recoilTime += DeltaTime; if (bulletCountShoot <= 3) playerInWorld->AddControllerPitchInput(GetRecoilPitch(amplitude, recoilTime)); GunStartArrow->AddRelativeRotation(FRotator(-GetRecoilPitch(amplitude, recoilTime), 0, 0)); - //traceEnd = GunStartArrow->GetComponentLocation() + (GunStartArrow->GetComponentRotation().Pitch * GetRecoilPitch(amplitude, recoilTime)); playerInWorld->AddControllerYawInput(GetRecoilYaw(amplitude, recoilTime)); - //UE_LOG(LogTemp, Warning, TEXT("recoilTime: %f"), recoilTime); UpdateSamples(amplitude, recoilTime); } } @@ -155,24 +157,20 @@ void ABaseWeaponClass::Fire() //do damage fallof based off distance traceStart = GunStartArrow->GetComponentLocation(); traceEnd = traceStart + (GunStartArrow->GetForwardVector() * BulletDistance); - /*RecoilVerticalLimit(outHit);*/ if (GetWorldTimerManager().IsTimerActive(timerHandle)) return; GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams); - DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, false, 5.0f, 0U, 2.5f); + DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, false, 5.0f, 0U, 1.5f); playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1); currentAmmoCount -= 1; - UE_LOG(LogTemp, Display, TEXT("Ammo Count: %d"), currentAmmoCount); GenerateRecoilVector(); ClickDetectionTimer(); bulletCountShoot += 1; if (bulletCountShoot <= 1) { ogPlayerRotation = FRotator(playerControllerRef->GetControlRotation()); - UE_LOG(LogTemp, Display, TEXT("FIRST BULLET FIRED: %s"), *ogPlayerRotation.ToString()); } if (outHit.bBlockingHit) { - UE_LOG(LogTemp, Display, TEXT("Ammo Count: %s"), *outHit.GetActor()->GetName()); if (!Cast(outHit.GetActor())) return; Cast(outHit.GetActor())->TakeDamage(WeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this); } @@ -188,10 +186,10 @@ void ABaseWeaponClass::WeaponScopedFire() { if (endlessVendettaChar->bIsScoped) { - recoilMagnitude -= 0.2f; - recoilMaxAngleLeft /= 2.f; - recoilMaxAngleRight /= 2.f; - recoilMinMultiplier -= 0.2f; + recoilMagnitude = scopedRecoilMag; + recoilMaxAngleLeft = scopedMaxAngleLeft; + recoilMaxAngleRight = scopedMaxAngleRight; + recoilMinMultiplier = scopedMinMultiplier; } else diff --git a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h index 19175cef..4deb8c6c 100644 --- a/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h +++ b/EndlessVendetta/Source/EndlessVendetta/WeaponSystem/BaseWeaponClass.h @@ -24,9 +24,9 @@ protected: // Called when the game starts or when spawned virtual void BeginPlay() override; - void GenerateRecoilVector(); - void ApplyRecoil(float DeltaTime); + + void GenerateRecoilVector(); void nullSamples(); @@ -44,7 +44,7 @@ protected: public: // Called every frame virtual void Tick(float DeltaTime) override; - + UPROPERTY(EditAnywhere) FName WeaponName; @@ -57,9 +57,25 @@ public: UPROPERTY(EditAnywhere) int MagazineSize; + //how many bullets until the recoil stops going up + UPROPERTY(EditAnywhere) + int howMnyShotsTillRclStop; + UPROPERTY(EditAnywhere) UTexture2D* WeaponImage; + UPROPERTY(EditAnywhere, Category = "ScopedFire") + float scopedRecoilMag; + + UPROPERTY(EditAnywhere, Category = "ScopedFire") + float scopedMaxAngleLeft; + + UPROPERTY(EditAnywhere, Category = "ScopedFire") + float scopedMaxAngleRight; + + UPROPERTY(EditAnywhere, Category = "ScopedFire") + float scopedMinMultiplier; + UFUNCTION(BlueprintCallable, Category = "Weapons") virtual void Fire();