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)
|
||||
{
|
||||
player->AddWeaponToInventory(Weapon);
|
||||
player->WeaponInventory.Last()->SetWeaponProperties(*WeaponComponent->GetWeaponProperties());
|
||||
|
||||
this->Destroy();
|
||||
WeaponComponent->Destroy();
|
||||
|
@ -75,6 +76,16 @@ void AWeaponPickup::SetWeapon(TSubclassOf<class AWeapon> weapon)
|
|||
SpawnWeapon();
|
||||
}
|
||||
|
||||
FWeaponProperties* AWeaponPickup::GetWeaponProperties()
|
||||
{
|
||||
return &WeaponProperties;
|
||||
}
|
||||
|
||||
void AWeaponPickup::SetWeaponProperties(FWeaponProperties FWeaponProperties)
|
||||
{
|
||||
WeaponComponent->SetWeaponProperties(FWeaponProperties);
|
||||
}
|
||||
|
||||
void AWeaponPickup::SpawnWeapon()
|
||||
{
|
||||
FActorSpawnParameters SpawnParameters;
|
||||
|
|
|
@ -45,6 +45,8 @@ private:
|
|||
UPROPERTY()
|
||||
FVector WeaponStartingLocation;
|
||||
|
||||
FWeaponProperties WeaponProperties;
|
||||
|
||||
public:
|
||||
// Sets default values for this actor's properties
|
||||
AWeaponPickup();
|
||||
|
@ -62,6 +64,10 @@ public:
|
|||
|
||||
void SetWeapon(TSubclassOf<class AWeapon> weapon);
|
||||
|
||||
FWeaponProperties* GetWeaponProperties();
|
||||
|
||||
void SetWeaponProperties(FWeaponProperties FWeaponProperties);
|
||||
|
||||
private:
|
||||
|
||||
void SpawnWeapon();
|
||||
|
|
Loading…
Reference in New Issue