Add ThrowableInventory to NakatomiCharacter
This commit is contained in:
parent
5a8c542581
commit
04512d1717
|
@ -214,6 +214,24 @@ void ANakatomiCharacter::OnFire()
|
|||
OnFired.ExecuteIfBound();
|
||||
}
|
||||
|
||||
AThrowable* ANakatomiCharacter::PopThrowableFromInventory()
|
||||
{
|
||||
if (ThrowableInventory.Num() > 0)
|
||||
{
|
||||
return ThrowableInventory.Pop();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void ANakatomiCharacter::PushThrowableToInventory(AThrowable* Throwable)
|
||||
{
|
||||
if (ThrowableInventory.Num() < MaximumThrowableInventorySize)
|
||||
{
|
||||
ThrowableInventory.Push(Throwable);
|
||||
}
|
||||
}
|
||||
|
||||
void ANakatomiCharacter::CalculateHits(TArray<FHitResult>* hits)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Character.h"
|
||||
#include "HealthComponent.h"
|
||||
#include "Throwable.h"
|
||||
#include "Weapon.h"
|
||||
#include "NakatomiCharacter.generated.h"
|
||||
|
||||
|
@ -34,12 +35,18 @@ public:
|
|||
UPROPERTY()
|
||||
AWeapon* CurrentWeapon = nullptr;
|
||||
|
||||
UPROPERTY()
|
||||
TArray<AThrowable*> ThrowableInventory;
|
||||
|
||||
private:
|
||||
UPROPERTY(VisibleDefaultsOnly)
|
||||
UHealthComponent* HealthComponent = nullptr;
|
||||
|
||||
int CurrentInventorySlot = 0;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly)
|
||||
int MaximumThrowableInventorySize = 4;
|
||||
|
||||
public:
|
||||
// Sets default values for this character's properties
|
||||
ANakatomiCharacter();
|
||||
|
@ -87,6 +94,10 @@ public:
|
|||
|
||||
virtual void OnFire();
|
||||
|
||||
AThrowable* PopThrowableFromInventory();
|
||||
|
||||
void PushThrowableToInventory(AThrowable* Throwable);
|
||||
|
||||
protected:
|
||||
virtual void CalculateHits(TArray<FHitResult>* hits);
|
||||
|
||||
|
|
Loading…
Reference in New Issue