Added Full Weapon Damage Drop Off To All Guns
This commit is contained in:
parent
34ef5c6e40
commit
783e7bd136
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WBP_AmmoCount.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WBP_AmmoCount.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WBP_WeaponStatsPrompt.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/FirstPerson/Blueprints/BaseWeapons/WBP_WeaponStatsPrompt.uasset
(Stored with Git LFS)
Binary file not shown.
@ -183,8 +183,16 @@ void ABaseWeaponClass::Fire()
|
|||||||
bStopShooting = false;
|
bStopShooting = false;
|
||||||
if (outHit.bBlockingHit)
|
if (outHit.bBlockingHit)
|
||||||
{
|
{
|
||||||
|
if (outHit.Distance >= FMath::Floor(BulletDistance/2))
|
||||||
|
{
|
||||||
|
tempWeaponDamage = WeaponDamage / 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempWeaponDamage = WeaponDamage;
|
||||||
|
}
|
||||||
if (!Cast<AAICharacter>(outHit.GetActor())) return;
|
if (!Cast<AAICharacter>(outHit.GetActor())) return;
|
||||||
Cast<AAICharacter>(outHit.GetActor())->TakeDamage(WeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
|
Cast<AAICharacter>(outHit.GetActor())->TakeDamage(tempWeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(currentAmmoCount <= 0)
|
else if(currentAmmoCount <= 0)
|
||||||
|
@ -180,6 +180,7 @@ protected:
|
|||||||
UArrowComponent* GunStartArrow;
|
UArrowComponent* GunStartArrow;
|
||||||
bool bStopShooting = false;
|
bool bStopShooting = false;
|
||||||
|
|
||||||
|
UPROPERTY(VisibleAnywhere)
|
||||||
int tempWeaponDamage;
|
int tempWeaponDamage;
|
||||||
|
|
||||||
float originalMagnitude;
|
float originalMagnitude;
|
||||||
|
@ -27,15 +27,6 @@ void AShotgunClass::Fire()
|
|||||||
{
|
{
|
||||||
FVector newStartTrace = UKismetMathLibrary::RandomPointInBoundingBox(traceStart, ShotgunBulletSpread);
|
FVector newStartTrace = UKismetMathLibrary::RandomPointInBoundingBox(traceStart, ShotgunBulletSpread);
|
||||||
traceEnd = newStartTrace + (GunStartArrow->GetForwardVector() * BulletDistance);
|
traceEnd = newStartTrace + (GunStartArrow->GetForwardVector() * BulletDistance);
|
||||||
if (outHit.Distance >= FMath::Floor(BulletDistance/1.5))
|
|
||||||
{
|
|
||||||
tempWeaponDamage /= 2;
|
|
||||||
GLog->Log("Bullet distance reached a quarter");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tempWeaponDamage = WeaponDamage;
|
|
||||||
}
|
|
||||||
GetWorld()->LineTraceSingleByChannel(outHit, newStartTrace, traceEnd, ECC_Visibility, collisionParams);
|
GetWorld()->LineTraceSingleByChannel(outHit, newStartTrace, traceEnd, ECC_Visibility, collisionParams);
|
||||||
DrawDebugLine(this->GetWorld(), newStartTrace, traceEnd, FColor::Red , false, 100.f, 0U, 1.f);
|
DrawDebugLine(this->GetWorld(), newStartTrace, traceEnd, FColor::Red , false, 100.f, 0U, 1.f);
|
||||||
currentAmmoCount --;
|
currentAmmoCount --;
|
||||||
@ -47,8 +38,16 @@ void AShotgunClass::Fire()
|
|||||||
bStopShooting = false;
|
bStopShooting = false;
|
||||||
if (outHit.bBlockingHit)
|
if (outHit.bBlockingHit)
|
||||||
{
|
{
|
||||||
|
if (outHit.Distance >= FMath::Floor(BulletDistance/2))
|
||||||
|
{
|
||||||
|
tempWeaponDamage = WeaponDamage / 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempWeaponDamage = WeaponDamage;
|
||||||
|
}
|
||||||
if (!Cast<AAICharacter>(outHit.GetActor())) return;
|
if (!Cast<AAICharacter>(outHit.GetActor())) return;
|
||||||
Cast<AAICharacter>(outHit.GetActor())->TakeDamage(WeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
|
Cast<AAICharacter>(outHit.GetActor())->TakeDamage(tempWeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(currentAmmoCount <= 0)
|
else if(currentAmmoCount <= 0)
|
||||||
|
@ -58,9 +58,16 @@ void ASniperClass::Fire()
|
|||||||
this->GetWorld()->GetTimerManager().SetTimer(SniperTimerHandle, this, &ASniperClass::StopFire, FireRate, false);
|
this->GetWorld()->GetTimerManager().SetTimer(SniperTimerHandle, this, &ASniperClass::StopFire, FireRate, false);
|
||||||
if (outHit.bBlockingHit)
|
if (outHit.bBlockingHit)
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Display, TEXT("Hit: %s"), *outHit.GetActor()->GetName());
|
if (outHit.Distance >= FMath::Floor(BulletDistance/2))
|
||||||
|
{
|
||||||
|
tempWeaponDamage = WeaponDamage / 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempWeaponDamage = WeaponDamage;
|
||||||
|
}
|
||||||
if (!Cast<AAICharacter>(outHit.GetActor())) return;
|
if (!Cast<AAICharacter>(outHit.GetActor())) return;
|
||||||
Cast<AAICharacter>(outHit.GetActor())->TakeDamage(WeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
|
Cast<AAICharacter>(outHit.GetActor())->TakeDamage(tempWeaponDamage, FPointDamageEvent(), GetWorld()->GetFirstPlayerController(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(currentAmmoCount <= 0)
|
else if(currentAmmoCount <= 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user