Modify current weapon checking in ThrowWeaponCallback
This commit is contained in:
parent
da1fcc15bd
commit
dc0ed36573
|
@ -602,6 +602,8 @@ float APlayerCharacter::GetWeaponSpread()
|
||||||
|
|
||||||
void APlayerCharacter::ThrowWeaponCallback()
|
void APlayerCharacter::ThrowWeaponCallback()
|
||||||
{
|
{
|
||||||
|
if (CurrentWeapon)
|
||||||
|
{
|
||||||
FVector Location;
|
FVector Location;
|
||||||
FVector BoxExtent;
|
FVector BoxExtent;
|
||||||
GetActorBounds(true, Location, BoxExtent, false);
|
GetActorBounds(true, Location, BoxExtent, false);
|
||||||
|
@ -610,15 +612,15 @@ void APlayerCharacter::ThrowWeaponCallback()
|
||||||
SpawnLocation += Location;
|
SpawnLocation += Location;
|
||||||
SpawnLocation.Z += BoxExtent.Z;
|
SpawnLocation.Z += BoxExtent.Z;
|
||||||
|
|
||||||
if (TSubclassOf<AWeaponThrowable> WeaponThrowableTemplate = GetCurrentWeapon()->GetWeaponThrowableTemplate())
|
TSubclassOf<AWeaponThrowable> WeaponThrowableTemplate = CurrentWeapon->GetWeaponThrowableTemplate();
|
||||||
{
|
|
||||||
AWeaponThrowable* Throwable = GetWorld()->SpawnActor<AWeaponThrowable>(
|
AWeaponThrowable* Throwable = GetWorld()->SpawnActor<AWeaponThrowable>(
|
||||||
WeaponThrowableTemplate, SpawnLocation, FRotator::ZeroRotator);
|
WeaponThrowableTemplate, SpawnLocation, FRotator::ZeroRotator);
|
||||||
|
|
||||||
Throwable->SetWeaponSkeletalMesh(GetCurrentWeapon()->GetSkeletalMesh());
|
Throwable->SetWeaponSkeletalMesh(GetCurrentWeapon()->GetSkeletalMesh());
|
||||||
}
|
|
||||||
|
|
||||||
RemoveCurrentWeaponFromInventory();
|
RemoveCurrentWeaponFromInventory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void APlayerCharacter::ThrowExplosiveCallback()
|
void APlayerCharacter::ThrowExplosiveCallback()
|
||||||
|
|
Loading…
Reference in New Issue