diff --git a/Source/Nakatomi/RandomWeaponParameters.cpp b/Source/Nakatomi/RandomWeaponParameters.cpp new file mode 100644 index 0000000..a1cf905 --- /dev/null +++ b/Source/Nakatomi/RandomWeaponParameters.cpp @@ -0,0 +1,41 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "RandomWeaponParameters.h" + +// Add default functionality here for any IRandomWeaponParameters functions that are not pure virtual. + +FWeaponProperties URandomWeaponParameters::GenerateRandomWeaponProperties() +{ + FWeaponProperties weaponProperties = FWeaponProperties(); + + weaponProperties.WeaponCooldown = FMath::FRandRange(CooldownMin, CooldownMax); + weaponProperties.WeaponDamage = FMath::FRandRange(DamageMin, DamageMax); + weaponProperties.WeaponChangeTime = FMath::FRandRange(ChangeTimeMin, ChangeTimeMax); + weaponProperties.MaxAmmo = FMath::RandRange(MaxAmmoMin, MaxAmmoMax); + weaponProperties.DefaultAmmo = FMath::FRandRange(weaponProperties.MaxAmmo * 0.25, weaponProperties.MaxAmmo * 0.75); + weaponProperties.ProjectilesPerShot = FMath::RandRange(ProjectilePerShotMin, ProjectilePerShotMax); + weaponProperties.ProjectileRange = FMath::FRandRange(ProjectileRangeMin, ProjectileRangeMax); + weaponProperties.WeaponSpread = FMath::FRandRange(WeaponSpreadMin, WeaponSpreadMax); + + if (IsAutomaticOverride) + { + weaponProperties.IsAutomatic = IsAutomaticOverride; + } + else + { + weaponProperties.IsAutomatic = bool(FMath::Rand() % 2); + } + + return weaponProperties; +} + +AWeapon URandomWeaponParameters::GenerateWeapon() +{ + return AWeapon(); +} + +AWeaponPickup URandomWeaponParameters::GenerateWeaponPickup() +{ + return AWeaponPickup(); +} diff --git a/Source/Nakatomi/RandomWeaponParameters.h b/Source/Nakatomi/RandomWeaponParameters.h new file mode 100644 index 0000000..1e8d263 --- /dev/null +++ b/Source/Nakatomi/RandomWeaponParameters.h @@ -0,0 +1,80 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Weapon.h" +#include "WeaponProperties.h" +#include "WeaponPickup.h" +#include "RandomWeaponParameters.generated.h" + + +/** + * + */ +UCLASS(Blueprintable) +class NAKATOMI_API URandomWeaponParameters : public UObject +{ + GENERATED_BODY() + +public: + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cooldown") + float CooldownMin = 0.1f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cooldown") + float CooldownMax = 2.0f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage") + float DamageMin = 10.f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage") + float DamageMax = 10.f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Change Time") + float ChangeTimeMin = 0.1f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Change Time") + float ChangeTimeMax = 2.0f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Max Ammo") + int MaxAmmoMin = 4; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Max Ammo") + int MaxAmmoMax = 200; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default Ammo") + int DefaultAmmoMin = 4; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Default Ammo") + int DefaultAmmoMax = 200; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Projectile Per Shot") + int ProjectilePerShotMin = 4; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Projectile Per Shot") + int ProjectilePerShotMax = 200; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Projectile Range") + float ProjectileRangeMin = 100.f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Projectile Range") + float ProjectileRangeMax = 25000.0f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Spread") + float WeaponSpreadMin = 0.f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Weapon Spread") + float WeaponSpreadMax = 15.0f; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Is Automatic") + bool IsAutomaticOverride = false; + + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Is Automatic") + TArray WeaponMesh; + + FWeaponProperties GenerateRandomWeaponProperties(); + + AWeapon GenerateWeapon(); + + AWeaponPickup GenerateWeaponPickup(); +};