This commit is contained in:
Antoine Caru 2025-03-16 19:56:39 +01:00
commit c3d74df76e
14 changed files with 33 additions and 19 deletions

View File

@ -3,7 +3,7 @@
[/Script/EngineSettings.GameMapsSettings] [/Script/EngineSettings.GameMapsSettings]
GameDefaultMap=/Game/Legumix/MainMenu/LVL_MainMenu.LVL_MainMenu GameDefaultMap=/Game/Legumix/MainMenu/LVL_MainMenu.LVL_MainMenu
GlobalDefaultGameMode=/Game/Legumix/BP_GameMode.BP_GameMode_C GlobalDefaultGameMode=/Game/Legumix/BP_GameMode.BP_GameMode_C
EditorStartupMap=/Game/Legumix/Levels/LVL_GYM_00.LVL_GYM_00 EditorStartupMap=/Game/Legumix/Levels/LVL_TEST_003.LVL_TEST_003
GameInstanceClass=/Game/Legumix/BP_GameInstance.BP_GameInstance_C GameInstanceClass=/Game/Legumix/BP_GameInstance.BP_GameInstance_C
[/Script/Engine.RendererSettings] [/Script/Engine.RendererSettings]

BIN
Content/Legumix/Drops/BP_AmmoPack.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Legumix/Drops/BP_DropRevolver.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Legumix/Drops/BP_DropShotgun.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Legumix/Drops/BP_HealthPack.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Legumix/Drops/BP_ItemDrop.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/Legumix/Drops/BP_ItemDropRevolver.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Legumix/Drops/BP_ItemDropShotgun.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -28,11 +28,11 @@ void ULMItemDropComponent::TryDropItems()
if (ALMPlayer* Player = Cast<ALMPlayer>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0))) if (ALMPlayer* Player = Cast<ALMPlayer>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0)))
{ {
Result = FMath::RandRange(0.f, 1.f); Result = FMath::RandRange(0.f, 1.f);
const FLMAmmoData Ammo = Player->GetWeaponManager()->GetAmmoData(AmmoType); const FLMAmmoData Test = Player->GetWeaponManager()->GetAmmoDataMap().FindRef(AmmoType);
const float Percentage = static_cast<float>(Ammo.AmmoCount) / static_cast<float>(Ammo.MaxAmmo); const float Percentage = static_cast<float>(Test.AmmoCount) / static_cast<float>(Test.MaxAmmo);
const float DropChance = DropChanceAtRemainingAmmo->GetFloatValue(Percentage); const float DropChance = DropChanceAtRemainingAmmo->GetFloatValue(Percentage);
FString Random = FString::Printf(TEXT("Drop Chance of %f for ammo (%i / %i) %f with random at %f"), DropChance, Ammo.AmmoCount, Ammo.MaxAmmo, Percentage, Result); FString Random = FString::Printf(TEXT("Drop Chance of %f for ammo (%i / %i) %f with random at %f"), DropChance, Test.AmmoCount, Test.MaxAmmo, Percentage, Result);
GEngine->AddOnScreenDebugMessage(INDEX_NONE, 5.f, FColor::Green, Random); GEngine->AddOnScreenDebugMessage(INDEX_NONE, 5.f, FColor::Green, Random);
if (DropChance >= Result) if (DropChance >= Result)
{ {

View File

@ -3,6 +3,6 @@
UENUM(BlueprintType) UENUM(BlueprintType)
enum class EAmmoType : uint8 enum class EAmmoType : uint8
{ {
EAT_RadishAmmo UMETA(DisplayName = "Radish Ammo"), EAT_RadishAmmo UMETA(DisplayName = "Revolver Ammo"),
EAT_CornAmmo UMETA(DisplayName = "Corn Ammo") EAT_CornAmmo UMETA(DisplayName = "Shotgun Ammo")
}; };

View File

@ -58,6 +58,8 @@ public:
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void CreateTracer(EAmmoType Ammo, FVector EndLocation, FRotator Direction); void CreateTracer(EAmmoType Ammo, FVector EndLocation, FRotator Direction);
TMap<EAmmoType, FLMAmmoData> GetAmmoDataMap() { return AmmoData; }
public: public:
UPROPERTY(BlueprintAssignable, BlueprintCallable, Category=Legumix) UPROPERTY(BlueprintAssignable, BlueprintCallable, Category=Legumix)
FOnWeaponFiredSignature WeaponFired; FOnWeaponFiredSignature WeaponFired;