Updated drop system
Signed-off-by: TjgL <lithmoneo@gmail.com>
This commit is contained in:
parent
d8a1e924ce
commit
6e1ffc8664
@ -3,7 +3,7 @@
|
||||
[/Script/EngineSettings.GameMapsSettings]
|
||||
GameDefaultMap=/Game/Legumix/MainMenu/LVL_MainMenu.LVL_MainMenu
|
||||
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
|
||||
|
||||
[/Script/Engine.RendererSettings]
|
||||
|
BIN
Content/Legumix/Drops/BP_AmmoPack.uasset
(Stored with Git LFS)
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
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
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)
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)
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
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
BIN
Content/Legumix/Drops/BP_ItemDropShotgun.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Content/Legumix/Drops/C_AmmoPackDropRate.uasset
(Stored with Git LFS)
BIN
Content/Legumix/Drops/C_AmmoPackDropRate.uasset
(Stored with Git LFS)
Binary file not shown.
@ -28,11 +28,11 @@ void ULMItemDropComponent::TryDropItems()
|
||||
if (ALMPlayer* Player = Cast<ALMPlayer>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0)))
|
||||
{
|
||||
Result = FMath::RandRange(0.f, 1.f);
|
||||
const FLMAmmoData Ammo = Player->GetWeaponManager()->GetAmmoData(AmmoType);
|
||||
const float Percentage = static_cast<float>(Ammo.AmmoCount) / static_cast<float>(Ammo.MaxAmmo);
|
||||
const FLMAmmoData Test = Player->GetWeaponManager()->GetAmmoDataMap().FindRef(AmmoType);
|
||||
const float Percentage = static_cast<float>(Test.AmmoCount) / static_cast<float>(Test.MaxAmmo);
|
||||
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);
|
||||
if (DropChance >= Result)
|
||||
{
|
||||
|
@ -3,6 +3,6 @@
|
||||
UENUM(BlueprintType)
|
||||
enum class EAmmoType : uint8
|
||||
{
|
||||
EAT_RadishAmmo UMETA(DisplayName = "Radish Ammo"),
|
||||
EAT_CornAmmo UMETA(DisplayName = "Corn Ammo")
|
||||
EAT_RadishAmmo UMETA(DisplayName = "Revolver Ammo"),
|
||||
EAT_CornAmmo UMETA(DisplayName = "Shotgun Ammo")
|
||||
};
|
@ -58,6 +58,8 @@ public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void CreateTracer(EAmmoType Ammo, FVector EndLocation, FRotator Direction);
|
||||
|
||||
TMap<EAmmoType, FLMAmmoData> GetAmmoDataMap() { return AmmoData; }
|
||||
|
||||
public:
|
||||
UPROPERTY(BlueprintAssignable, BlueprintCallable, Category=Legumix)
|
||||
FOnWeaponFiredSignature WeaponFired;
|
||||
|
Reference in New Issue
Block a user