Move Inventory Methods to base Character class
This commit is contained in:
parent
ecff0b36a8
commit
44f69a4355
|
@ -154,6 +154,19 @@ void ANakatomiCharacter::AddWeaponToInventory(TSubclassOf<class AWeapon> weapon)
|
|||
}
|
||||
}
|
||||
|
||||
void ANakatomiCharacter::AddWeaponToInventory(AWeapon* weapon)
|
||||
{
|
||||
weapon->AttachToComponent(GetMesh(), FAttachmentTransformRules::SnapToTargetNotIncludingScale, "WeaponHand");
|
||||
weapon->SetActorEnableCollision(false);
|
||||
weapon->SetActorHiddenInGame(true);
|
||||
WeaponInventory.Add(weapon);
|
||||
|
||||
if (WeaponInventory.Num() == 1)
|
||||
{
|
||||
SetCurrentWeapon(WeaponInventory[0]);
|
||||
}
|
||||
}
|
||||
|
||||
AWeapon* ANakatomiCharacter::InitializeWeapon(TSubclassOf<class AWeapon> weapon)
|
||||
{
|
||||
FActorSpawnParameters SpawnParameters;
|
||||
|
@ -188,4 +201,9 @@ void ANakatomiCharacter::SetCurrentWeapon(AWeapon* weapon)
|
|||
CurrentWeapon = weapon;
|
||||
CurrentWeapon->SetActorHiddenInGame(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ANakatomiCharacter::GetCurrentInventorySlot()
|
||||
{
|
||||
return CurrentInventorySlot;
|
||||
}
|
||||
|
|
|
@ -63,6 +63,8 @@ public:
|
|||
|
||||
void AddWeaponToInventory(TSubclassOf<class AWeapon> weapon);
|
||||
|
||||
void AddWeaponToInventory(AWeapon* weapon);
|
||||
|
||||
void RemoveWeaponFromInventory(int i);
|
||||
|
||||
void RemoveWeaponFromInventory(AWeapon* weapon);
|
||||
|
@ -74,4 +76,6 @@ public:
|
|||
AWeapon* GetCurrentWeapon();
|
||||
|
||||
void SetCurrentWeapon(AWeapon* weapon);
|
||||
|
||||
int GetCurrentInventorySlot();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue