Merge branch 'WeaponSystem' into BackupBuild

This commit is contained in:
Rafal Swierczek 2023-10-16 13:31:46 +01:00
commit 4219d01ae7
5 changed files with 28 additions and 7 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:652402df45503ab3169e329879f397101d9b5bf17551404301cca7b5b292eb68
size 62076
oid sha256:d593d68d5b9a9fc58b1b7ecc44936b84e361aaa1762ab04c5924e36bfd45bee9
size 61494

View File

@ -174,7 +174,7 @@ void ABaseWeaponClass::Fire()
traceEnd = traceStart + (GunStartArrow->GetForwardVector() * BulletDistance);
if (GetWorldTimerManager().IsTimerActive(timerHandle)) return;
GetWorld()->LineTraceSingleByChannel(outHit, traceStart, traceEnd, ECC_Visibility, collisionParams);
DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Red, false, 5.0f, 0U, 1.5f);
DrawDebugLine(this->GetWorld(), traceStart, traceEnd, FColor::Black , false, 0.2f, 0U, 0.2f);
playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1);
currentAmmoCount -= 1;
GenerateRecoilVector();

View File

@ -83,9 +83,9 @@ public:
virtual void Fire();
UFUNCTION(BlueprintCallable, Category = "Weapons")
void ClickDetectionTimer();
virtual void ClickDetectionTimer();
void CancelFire();
virtual void CancelFire();
UPROPERTY(VisibleAnywhere)
ACharacter* playerInWorld;
@ -144,9 +144,12 @@ public:
UPROPERTY(EditAnywhere)
int bulletCountShoot; //Gets how many bullets shot per
private:
protected:
UArrowComponent* GunStartArrow;
bool bStopShooting = false;
private:
UPROPERTY(EditAnywhere)
float BulletDistance;
@ -157,5 +160,5 @@ private:
float originalMinMultiplier;
float currentPitch;
bool bStopShooting = false;
};

View File

@ -30,3 +30,19 @@ void APistolClass::Fire()
UE_LOG(LogTemp, Display, TEXT("Testing overrides: Pistol has been fired"));
}
void APistolClass::ClickDetectionTimer()
{
Super::ClickDetectionTimer();
}
void APistolClass::CancelFire()
{
if (bulletCountShoot <= 0) return;
UE_LOG(LogTemp, Display, TEXT("FireCancelled"));
bulletCountShoot = 0;
GunStartArrow->SetRelativeRotation(FRotator(0));
//playerInWorld->GetController()->SetControlRotation(FRotator(0, playerInWorld->GetActorRotation().Yaw, playerInWorld->GetActorRotation().Roll));
bStopShooting = true;
nullSamples();
}

View File

@ -24,4 +24,6 @@ public:
virtual void Tick(float DeltaTime) override;
virtual void Fire() override;
virtual void ClickDetectionTimer() override;
virtual void CancelFire() override;
};