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