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 HUD icons and label for weapons #151

Merged
merged 1 commit into from
Jan 31, 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/Blueprints/Game/BP_Cloud9GameInstance.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Weapons/FirearmWeaponsTable.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Weapons/WeaponTableDefinitions.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Widgets/HudWidget.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Widgets/InventoryRow.uasset
Binary file not shown.
Binary file modified Content/Blueprints/Widgets/InventoryWidget.uasset
Binary file not shown.
20 changes: 10 additions & 10 deletions Source/Cloud9/Character/Cloud9Character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,14 @@ void ACloud9Character::Tick(float DeltaSeconds)
Inventory->SelectOtherAvailableWeapon(false);
}

// TODO: Remove auto grenade add after debug
if (not Inventory->GetWeaponAt(EWeaponSlot::Grenade) and Inventory->GetSelectedWeapon() != nullptr)
{
if (let GameInstance = GetGameInstance<UCloud9GameInstance>(); IsValid(GameInstance))
{
GameInstance->GetDefaultWeaponsConfig()
| ETContainer::Filter{[this](let& Config) { return IsValid(Config) and Config.IsGrenadeWeapon(); }}
| ETContainer::ForEach{[this](let& Config) { Inventory->AddWeapon(Config); }};
}
}
// // TODO: Remove auto grenade add after debug
// if (not Inventory->GetWeaponAt(EWeaponSlot::Grenade) and Inventory->GetSelectedWeapon() != nullptr)
// {
// if (let GameInstance = GetGameInstance<UCloud9GameInstance>(); IsValid(GameInstance))
// {
// GameInstance->GetDefaultWeaponsConfig()
// | ETContainer::Filter{[this](let& Config) { return IsValid(Config) and Config.IsGrenadeWeapon(); }}
// | ETContainer::ForEach{[this](let& Config) { Inventory->AddWeapon(Config); }};
// }
// }
}
9 changes: 5 additions & 4 deletions Source/Cloud9/Weapon/Notifiers/Cloud9AnimNotifyPlaySound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@ bool UCloud9AnimNotifyPlaySound::PlayFirearmSound(USkeletalMeshComponent* MeshCo
case EWeaponSoundType::Secondary:
return UCloud9SoundPlayer::PlaySoundByName(WeaponInfo->Sounds.ZoomSounds, Name, Location, Volume);
case EWeaponSoundType::LowAmmo:
if (SelectedWeapon->GetCurrentAmmo() < WeaponInfo->LowAmmoCount)
if (SelectedWeapon->GetCurrentAmmo() <= WeaponInfo->LowAmmoCount)
{
let LowAmmoVolume = CommonData->Firearm.LowAmmoVolumeMultiplier * Volume;
return UCloud9SoundPlayer::PlaySingleSound(CommonData->Firearm.LowAmmo, Location, LowAmmoVolume);
return UCloud9SoundPlayer::PlaySingleSound(CommonData->Firearm.LowAmmoSound, Location, LowAmmoVolume);
}
return false;
default:
log(Error, "[Notify='%s'] Invalid sound type for firearm sound", *GetName());
log(Error, "[Notify='%s'] Invalid sound type for firearm sound SoundType=%d", *GetName(), SoundType);
return false;
}
}
Expand Down Expand Up @@ -119,7 +120,7 @@ bool UCloud9AnimNotifyPlaySound::PlayGrenadeSound(USkeletalMeshComponent* MeshCo
case EWeaponSoundType::Primary:
return UCloud9SoundPlayer::PlaySingleSound(WeaponInfo->Sounds.ThrowSound, Location, Volume);
default:
log(Error, "[Notify='%s'] Invalid sound type for firearm sound", *GetName());
log(Error, "[Notify='%s'] Invalid sound type for firearm sound SoundType=%d", *GetName(), SoundType);
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Cloud9/Weapon/Tables/WeaponCommonData.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct FFirearmCommonData
UNiagaraSystem* Squib;

UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category=Sound)
USoundBase* LowAmmo;
USoundBase* LowAmmoSound;

UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category=Sound)
float LowAmmoVolumeMultiplier = 2.0f;
Expand Down