Update ThrowableInventory type

This commit is contained in:
baz 2023-09-20 01:56:13 +01:00
parent 7cdb9b1c69
commit 60bf490f8a
5 changed files with 15 additions and 6 deletions

BIN
Content/Throwables/Test.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Throwables/Throww.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Throwables/reee.uasset (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -214,7 +214,7 @@ void ANakatomiCharacter::OnFire()
OnFired.ExecuteIfBound(); OnFired.ExecuteIfBound();
} }
AThrowable* ANakatomiCharacter::PopThrowableFromInventory() TSubclassOf<AThrowable> ANakatomiCharacter::PopThrowableFromInventory()
{ {
if (ThrowableInventory.Num() > 0) if (ThrowableInventory.Num() > 0)
{ {
@ -224,7 +224,7 @@ AThrowable* ANakatomiCharacter::PopThrowableFromInventory()
return {}; return {};
} }
void ANakatomiCharacter::PushThrowableToInventory(AThrowable* Throwable) void ANakatomiCharacter::PushThrowableToInventory(TSubclassOf<AThrowable> Throwable)
{ {
if (ThrowableInventory.Num() < MaximumThrowableInventorySize) if (ThrowableInventory.Num() < MaximumThrowableInventorySize)
{ {

View File

@ -35,8 +35,8 @@ public:
UPROPERTY() UPROPERTY()
AWeapon* CurrentWeapon = nullptr; AWeapon* CurrentWeapon = nullptr;
UPROPERTY() UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TArray<AThrowable*> ThrowableInventory; TArray<TSubclassOf<AThrowable>> ThrowableInventory;
private: private:
UPROPERTY(VisibleDefaultsOnly) UPROPERTY(VisibleDefaultsOnly)
@ -94,9 +94,9 @@ public:
virtual void OnFire(); virtual void OnFire();
AThrowable* PopThrowableFromInventory(); TSubclassOf<AThrowable> PopThrowableFromInventory();
void PushThrowableToInventory(AThrowable* Throwable); void PushThrowableToInventory(TSubclassOf<AThrowable> Throwable);
protected: protected:
virtual void CalculateHits(TArray<FHitResult>* hits); virtual void CalculateHits(TArray<FHitResult>* hits);