Fixed Tap Fire Rate On All Pistols

This commit is contained in:
MARCEL HARA 2023-10-16 13:18:39 +01:00
parent e62345d690
commit fad7da57f8
4 changed files with 27 additions and 6 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

@ -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;
};