Update Save System
This commit is contained in:
parent
804a752aa5
commit
2b5d67346a
|
@ -50,8 +50,8 @@ bool UNakatomiGameInstance::SaveGame(bool ResetDefaults)
|
|||
{
|
||||
APlayerCharacter* Player = Cast<APlayerCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
|
||||
SaveGameObject->PlayerHealth = Player->GetCurrentHealthCount();
|
||||
SaveGameObject->WeaponInventory = Player->WeaponInventory;
|
||||
SaveGameObject->CurrentInventorySlot = Player->GetCurrentInventorySlot();
|
||||
// SaveGameObject->CurrentInventorySlot = Player->GetCurrentInventorySlot();
|
||||
SaveGameObject->ThrowableInventory = Player->ThrowableInventory;
|
||||
}
|
||||
|
||||
SaveGameObject->LevelName = GetWorld()->GetMapName();
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Weapon.h"
|
||||
#include "Throwable.h"
|
||||
#include "NakatomiSaveFileInfo.generated.h"
|
||||
|
||||
/**
|
||||
|
@ -24,4 +26,13 @@ struct FNakatomiSaveFileInfo
|
|||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Info")
|
||||
FString DateTimeSaved;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Info")
|
||||
TArray<AWeapon*> WeaponInventory;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Info")
|
||||
TArray<TSubclassOf<AThrowable>> ThrowableInventory;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Info")
|
||||
int CurrentInventorySlot = 0;
|
||||
};
|
||||
|
|
|
@ -28,6 +28,9 @@ public:
|
|||
UPROPERTY(VisibleAnywhere, Category = Player)
|
||||
TArray<AWeapon*> WeaponInventory;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, Category = Player)
|
||||
TArray<TSubclassOf<AThrowable>> ThrowableInventory;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, Category = Player)
|
||||
int CurrentInventorySlot = 0;
|
||||
|
||||
|
|
|
@ -87,6 +87,12 @@ void APlayerCharacter::BeginPlay()
|
|||
{
|
||||
//TODO: More loading here
|
||||
GetHealthComponent()->SetCurrentHealth(Save->PlayerHealth);
|
||||
|
||||
if (Save->ThrowableInventory.Num() > 0)
|
||||
{
|
||||
ThrowableInventory.Empty();
|
||||
ThrowableInventory = Save->ThrowableInventory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue