Create RandomWeapon class
This commit is contained in:
parent
3bf351782d
commit
4f65c38e0b
|
@ -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();
|
||||||
|
}
|
|
@ -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<USkeletalMesh*> WeaponMesh;
|
||||||
|
|
||||||
|
FWeaponProperties GenerateRandomWeaponProperties();
|
||||||
|
|
||||||
|
AWeapon GenerateWeapon();
|
||||||
|
|
||||||
|
AWeaponPickup GenerateWeaponPickup();
|
||||||
|
};
|
Loading…
Reference in New Issue