Store `WeaponProperties` in `WeaponPickup`
This commit is contained in:
parent
296074d97f
commit
bc26d04f83
|
@ -57,6 +57,7 @@ void AWeaponPickup::OnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AAc
|
||||||
if (player && Weapon)
|
if (player && Weapon)
|
||||||
{
|
{
|
||||||
player->AddWeaponToInventory(Weapon);
|
player->AddWeaponToInventory(Weapon);
|
||||||
|
player->WeaponInventory.Last()->SetWeaponProperties(*WeaponComponent->GetWeaponProperties());
|
||||||
|
|
||||||
this->Destroy();
|
this->Destroy();
|
||||||
WeaponComponent->Destroy();
|
WeaponComponent->Destroy();
|
||||||
|
@ -75,6 +76,16 @@ void AWeaponPickup::SetWeapon(TSubclassOf<class AWeapon> weapon)
|
||||||
SpawnWeapon();
|
SpawnWeapon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FWeaponProperties* AWeaponPickup::GetWeaponProperties()
|
||||||
|
{
|
||||||
|
return &WeaponProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AWeaponPickup::SetWeaponProperties(FWeaponProperties FWeaponProperties)
|
||||||
|
{
|
||||||
|
WeaponComponent->SetWeaponProperties(FWeaponProperties);
|
||||||
|
}
|
||||||
|
|
||||||
void AWeaponPickup::SpawnWeapon()
|
void AWeaponPickup::SpawnWeapon()
|
||||||
{
|
{
|
||||||
FActorSpawnParameters SpawnParameters;
|
FActorSpawnParameters SpawnParameters;
|
||||||
|
|
|
@ -45,6 +45,8 @@ private:
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
FVector WeaponStartingLocation;
|
FVector WeaponStartingLocation;
|
||||||
|
|
||||||
|
FWeaponProperties WeaponProperties;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Sets default values for this actor's properties
|
// Sets default values for this actor's properties
|
||||||
AWeaponPickup();
|
AWeaponPickup();
|
||||||
|
@ -62,6 +64,10 @@ public:
|
||||||
|
|
||||||
void SetWeapon(TSubclassOf<class AWeapon> weapon);
|
void SetWeapon(TSubclassOf<class AWeapon> weapon);
|
||||||
|
|
||||||
|
FWeaponProperties* GetWeaponProperties();
|
||||||
|
|
||||||
|
void SetWeaponProperties(FWeaponProperties FWeaponProperties);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void SpawnWeapon();
|
void SpawnWeapon();
|
||||||
|
|
Loading…
Reference in New Issue