135 - Submachine Gun

This commit is contained in:
Kingsmedia 2022-05-19 20:51:50 +02:00
parent 05ea304d46
commit 4e35bbf8a4
55 changed files with 42 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -273,6 +273,9 @@ void ABlasterCharacter::PlayReloadMontage()
case EWeaponType::EWT_Pistol: case EWeaponType::EWT_Pistol:
SectionName = FName("Rifle"); // Todo: create pistol reload montage section SectionName = FName("Rifle"); // Todo: create pistol reload montage section
break; break;
case EWeaponType::EWT_SubmachineGun:
SectionName = FName("Rifle"); // Todo: create SMG reload montage section
break;
default: default:
SectionName = FName("Rifle"); SectionName = FName("Rifle");
break; break;

View File

@ -457,4 +457,5 @@ void UCombatComponent::InitializeCarriedAmmo()
CarriedAmmoMap.Emplace(EWeaponType::EWT_AssaultRifle, StartingARAmmo); CarriedAmmoMap.Emplace(EWeaponType::EWT_AssaultRifle, StartingARAmmo);
CarriedAmmoMap.Emplace(EWeaponType::EWT_RocketLauncher, StartingRocketAmmo); CarriedAmmoMap.Emplace(EWeaponType::EWT_RocketLauncher, StartingRocketAmmo);
CarriedAmmoMap.Emplace(EWeaponType::EWT_Pistol, StartingPistolAmmo); CarriedAmmoMap.Emplace(EWeaponType::EWT_Pistol, StartingPistolAmmo);
CarriedAmmoMap.Emplace(EWeaponType::EWT_SubmachineGun, StartingSMGAmmo);
} }

View File

@ -129,6 +129,9 @@ private:
UPROPERTY(EditAnywhere) UPROPERTY(EditAnywhere)
int32 StartingPistolAmmo = 15; int32 StartingPistolAmmo = 15;
UPROPERTY(EditAnywhere)
int32 StartingSMGAmmo = 15;
void InitializeCarriedAmmo(); void InitializeCarriedAmmo();
UPROPERTY(ReplicatedUsing=OnRep_CombatState) UPROPERTY(ReplicatedUsing=OnRep_CombatState)

View File

@ -58,6 +58,15 @@ void AHitScanWeapon::Fire(const FVector& HitTarget)
FireHit.ImpactNormal.Rotation() FireHit.ImpactNormal.Rotation()
); );
} }
if (HitSound)
{
UGameplayStatics::PlaySoundAtLocation(
this,
HitSound,
FireHit.ImpactPoint
);
}
} }
if (BeamParticles) if (BeamParticles)
@ -73,5 +82,22 @@ void AHitScanWeapon::Fire(const FVector& HitTarget)
} }
} }
} }
if (MuzzleFlash)
{
UGameplayStatics::SpawnEmitterAtLocation(
World,
MuzzleFlash,
SocketTransform
);
}
if (FireSound)
{
UGameplayStatics::PlaySoundAtLocation(
this,
FireSound,
GetActorLocation()
);
}
} }
} }

View File

@ -29,4 +29,12 @@ private:
UPROPERTY(EditAnywhere) UPROPERTY(EditAnywhere)
UParticleSystem* BeamParticles; UParticleSystem* BeamParticles;
UPROPERTY(EditAnywhere)
UParticleSystem* MuzzleFlash;
UPROPERTY(EditAnywhere)
USoundCue* FireSound;
UPROPERTY(EditAnywhere)
USoundCue* HitSound;
}; };

View File

@ -6,6 +6,7 @@ enum class EWeaponType: uint8
EWT_AssaultRifle UMETA(DisplayName="Assault Rifle"), EWT_AssaultRifle UMETA(DisplayName="Assault Rifle"),
EWT_RocketLauncher UMETA(DisplayName="Rocket Launcher"), EWT_RocketLauncher UMETA(DisplayName="Rocket Launcher"),
EWT_Pistol UMETA(DisplayName="Pistol"), EWT_Pistol UMETA(DisplayName="Pistol"),
EWT_SubmachineGun UMETA(DisplayName="Submachine Gun"),
EWT_MAX UMETA(DisplayName="DefaultMAX") EWT_MAX UMETA(DisplayName="DefaultMAX")
}; };