Add `RandomWeapon` Class

This commit is contained in:
Louis Hobbs 2023-02-12 20:26:22 +00:00
parent 4363d2ad23
commit e83659123e
2 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,19 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "RandomWeapon.h"
ARandomWeapon::ARandomWeapon()
{
RandomWeaponParameters = CreateDefaultSubobject<URandomWeaponParameters>(TEXT("Random Weapon Parameters"));
}
void ARandomWeapon::BeginPlay()
{
WeaponProperties = RandomWeaponParameters->GenerateRandomWeaponProperties();
WeaponSkeletalMesh = RandomWeaponParameters->PickRandomMesh();
FireSound = RandomWeaponParameters->PickRandomSoundBase();
FieldSystemActor = RandomWeaponParameters->PickRandomFieldSystem();
Super::BeginPlay();
}

View File

@ -0,0 +1,29 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "RandomWeaponParameters.h"
#include "Weapon.h"
#include "RandomWeapon.generated.h"
/**
*
*/
UCLASS()
class NAKATOMI_API ARandomWeapon : public AWeapon
{
GENERATED_BODY()
private:
UPROPERTY(VisibleAnywhere, Category = "Random Weapon Parameters")
URandomWeaponParameters* RandomWeaponParameters;
public:
ARandomWeapon();
protected:
virtual void BeginPlay() override;
};