Update Legacy Weapons for Sound

This commit is contained in:
Philip W 2024-03-22 12:41:41 +00:00
parent 1559c61e8e
commit a7976f6749
4 changed files with 12 additions and 13 deletions

View File

@ -120,7 +120,7 @@ public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stats")
float StaminaDecreaseRate = 0.2;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stats")
float StaminaRegenRate = 0.05;
float StaminaRegenRate = 0.1;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Stats")
float SprintSpeed = 900;

View File

@ -10,7 +10,7 @@ AShotgunClass::AShotgunClass()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
ShotgunBulletSpread = FVector(10,10,10);
ShotgunBulletSpread = FVector(10, 10, 10);
}
void AShotgunClass::BeginPlay()
@ -26,7 +26,7 @@ void AShotgunClass::ClickDetectionTimer()
void AShotgunClass::Fire()
{
if(currentAmmoCount > 0 && !bSingleShotOnly)
if (currentAmmoCount > 0 && !bSingleShotOnly)
{
bSingleShotOnly = true;
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Magenta, TEXT("Fire Activated"));
@ -37,13 +37,14 @@ void AShotgunClass::Fire()
FVector newStartTrace = UKismetMathLibrary::RandomPointInBoundingBox(traceStart, ShotgunBulletSpread);
traceEnd = newStartTrace + (GunStartArrow->GetForwardVector() * BulletDistance);
GetWorld()->LineTraceSingleByChannel(outHit, newStartTrace, traceEnd, ECC_Visibility, collisionParams);
DrawDebugLine(this->GetWorld(), newStartTrace, traceEnd, FColor::Yellow , false, 500.2f, 0U, 0.2f);
DrawDebugLine(this->GetWorld(), newStartTrace, traceEnd, FColor::Yellow, false, 500.2f, 0U, 0.2f);
if (outHit.bBlockingHit)
{
GEngine->AddOnScreenDebugMessage(-1, 20.f, FColor::Orange, FString(TEXT("SHOTGUN HIT")));
}
}
currentAmmoCount --;
currentAmmoCount--;
WeaponFired.Broadcast();
playerControllerRef->PlayerCameraManager->StartCameraShake(CameraShakeClass, 1);
GenerateRecoilVector();
ClickDetectionTimer();
@ -52,7 +53,7 @@ void AShotgunClass::Fire()
bStopShooting = false;
if (outHit.bBlockingHit)
{
if (outHit.Distance >= FMath::Floor(BulletDistance/2))
if (outHit.Distance >= FMath::Floor(BulletDistance / 2))
{
tempWeaponDamage = WeaponDamage / 2;
}
@ -66,7 +67,7 @@ void AShotgunClass::Fire()
}
HideNeedReloadUI();
}
else if(currentAmmoCount <= 0)
else if (currentAmmoCount <= 0)
{
UE_LOG(LogTemp, Display, TEXT("No ammo, Ammo count: %d"), currentAmmoCount);
ShowNeedReloadUI();
@ -82,5 +83,3 @@ void AShotgunClass::StopFire()
{
bSingleShotOnly = false;
}