Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added impact bullet sounds for Physical Materials #261

Merged
merged 1 commit into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Content/Physicals/PM_Character.uasset
Binary file not shown.
Binary file modified Content/Physicals/PM_Concrete.uasset
Binary file not shown.
Binary file modified Content/Physicals/PM_Glass.uasset
Binary file not shown.
Binary file modified Content/Physicals/PM_Metal.uasset
Binary file not shown.
Binary file modified Content/Physicals/PM_Mud.uasset
Binary file not shown.
Binary file modified Content/Physicals/PM_Paper.uasset
Binary file not shown.
Binary file modified Content/Physicals/PM_Rock.uasset
Binary file not shown.
Binary file modified Content/Physicals/PM_Wood.uasset
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.
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.
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.
Binary file not shown.
Binary file added Content/Vefects/Audio/hpain1.uasset
Binary file not shown.
5 changes: 5 additions & 0 deletions Source/Cloud9/Physicals/Cloud9PhysicalMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ UCloud9PhysicalMaterial::UCloud9PhysicalMaterial()
FirearmBackgroundDecalRotationMax = 180.0f;
FirearmBackgroundDecalProbability = 0.5f;
FirearmBackgroundDecalMaxDistance = 200.0f;
FirearmHitSoundVolume = 1.0f;

GrenadeDecalSize = {8.0f, 8.0f, 8.0f};
MeleeDecalSize = {8.0f, 8.0f, 8.0f};
Expand Down Expand Up @@ -52,6 +53,10 @@ FRotator UCloud9PhysicalMaterial::GetFirearmDecalRotation(FVector Normal) const
return GetNormalSurfaceRotation(Normal, RandomRotation);
}

USoundBase* UCloud9PhysicalMaterial::GetRandomFirearmHitSound() const { return GetRandomItem(FirearmHitSounds); }

float UCloud9PhysicalMaterial::GetFirearmHitSoundVolume() const { return FirearmHitSoundVolume; }

UMaterialInterface* UCloud9PhysicalMaterial::GetRandomBackgroundDecal() const
{
return GetRandomItem(FirearmBackgroundDecals);
Expand Down
9 changes: 9 additions & 0 deletions Source/Cloud9/Physicals/Cloud9PhysicalMaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class CLOUD9_API UCloud9PhysicalMaterial : public UPhysicalMaterial

FVector GetFirearmDecalSize() const;
FRotator GetFirearmDecalRotation(FVector Normal) const;
USoundBase* GetRandomFirearmHitSound() const;
float GetFirearmHitSoundVolume() const;

protected:
UPROPERTY(EditDefaultsOnly, Category="Firearm Hit Decal")
Expand Down Expand Up @@ -81,6 +83,13 @@ class CLOUD9_API UCloud9PhysicalMaterial : public UPhysicalMaterial
meta=(UIMin="0", UIMax="1000", ClampMin="0", ClampMax="1000"))
float FirearmBackgroundDecalMaxDistance;

UPROPERTY(EditDefaultsOnly, Category="Firearm Hit Sound")
TSet<USoundBase*> FirearmHitSounds;

UPROPERTY(EditDefaultsOnly, Category="Firearm Hit Sound",
meta=(UIMin="0", UIMax="10.0", ClampMin="0", ClampMax="10.0"))
float FirearmHitSoundVolume;


UPROPERTY(EditDefaultsOnly, Category="Grenade Hit Decal")
TSet<UMaterialInterface*> GrenadeDecals;
Expand Down
9 changes: 9 additions & 0 deletions Source/Cloud9/Weapon/Classes/Cloud9WeaponFirearm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "Cloud9/Character/Damages/FirearmDamageType.h"
#include "Cloud9/Game/Cloud9DeveloperSettings.h"
#include "Cloud9/Physicals/Cloud9PhysicalMaterial.h"
#include "Cloud9/Tools/Extensions/USoundBase.h"
#include "Cloud9/Weapon/Sounds/Cloud9SoundPlayer.h"
#include "Cloud9/Weapon/Structures/WeaponConfig.h"
#include "Cloud9/Weapon/Tables/WeaponTableFirearm.h"
Expand Down Expand Up @@ -509,6 +510,14 @@ EFirearmFireStatus ACloud9WeaponFirearm::Fire(
};
}

if (let HitSound = PhysicalMaterial->GetRandomFirearmHitSound(); IsValid(HitSound))
{
HitSound | EUSoundBase::PlaySoundAtLocation{
.Location = LineHit.Location,
.VolumeMultiplier = Settings->Volume * PhysicalMaterial->GetFirearmHitSoundVolume()
};
}

if (let BackgroundDecal = PhysicalMaterial->GetRandomBackgroundDecal(); IsValid(BackgroundDecal))
{
if (PhysicalMaterial->TestBackgroundDecalProbability())
Expand Down