Load Health from save
This commit is contained in:
parent
ee9718e9e3
commit
0e9a36f1c9
|
@ -4,6 +4,8 @@
|
|||
#include "NakatomiCharacter.h"
|
||||
|
||||
#include "NakatomiCMC.h"
|
||||
#include "NakatomiGameInstance.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
// Sets default values
|
||||
ANakatomiCharacter::ANakatomiCharacter(const FObjectInitializer& ObjectInitializer) : Super(
|
||||
|
@ -30,6 +32,15 @@ void ANakatomiCharacter::BeginPlay()
|
|||
SetInventoryToDefault();
|
||||
|
||||
NakatomiCMC = Cast<UNakatomiCMC>(GetCharacterMovement());
|
||||
|
||||
if (UNakatomiGameInstance* gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld())))
|
||||
{
|
||||
if (UNakatomiSaveGame* Save = gameInstance->GetSaveGameObject())
|
||||
{
|
||||
//TODO: More loading here
|
||||
GetHealthComponent()->SetCurrentHealth(Save->PlayerHealth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called every frame
|
||||
|
|
Loading…
Reference in New Issue