Compare commits
No commits in common. "2b5d67346a224f716db343537be7d8411bfb01cd" and "0e9a36f1c900dea9a6009eb21dd0bc4aae220767" have entirely different histories.
2b5d67346a
...
0e9a36f1c9
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "NakatomiCMC.h"
|
||||
#include "NakatomiGameInstance.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
// Sets default values
|
||||
ANakatomiCharacter::ANakatomiCharacter(const FObjectInitializer& ObjectInitializer) : Super(
|
||||
|
@ -31,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
|
||||
|
|
|
@ -50,8 +50,8 @@ bool UNakatomiGameInstance::SaveGame(bool ResetDefaults)
|
|||
{
|
||||
APlayerCharacter* Player = Cast<APlayerCharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(), 0));
|
||||
SaveGameObject->PlayerHealth = Player->GetCurrentHealthCount();
|
||||
// SaveGameObject->CurrentInventorySlot = Player->GetCurrentInventorySlot();
|
||||
SaveGameObject->ThrowableInventory = Player->ThrowableInventory;
|
||||
SaveGameObject->WeaponInventory = Player->WeaponInventory;
|
||||
SaveGameObject->CurrentInventorySlot = Player->GetCurrentInventorySlot();
|
||||
}
|
||||
|
||||
SaveGameObject->LevelName = GetWorld()->GetMapName();
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Weapon.h"
|
||||
#include "Throwable.h"
|
||||
#include "NakatomiSaveFileInfo.generated.h"
|
||||
|
||||
/**
|
||||
|
@ -26,13 +24,4 @@ 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,9 +28,6 @@ public:
|
|||
UPROPERTY(VisibleAnywhere, Category = Player)
|
||||
TArray<AWeapon*> WeaponInventory;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, Category = Player)
|
||||
TArray<TSubclassOf<AThrowable>> ThrowableInventory;
|
||||
|
||||
UPROPERTY(VisibleAnywhere, Category = Player)
|
||||
int CurrentInventorySlot = 0;
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "InputTriggers.h"
|
||||
#include "InteractableComponent.h"
|
||||
#include "NakatomiCMC.h"
|
||||
#include "NakatomiGameInstance.h"
|
||||
#include "WeaponThrowable.h"
|
||||
#include "NiagaraFunctionLibrary.h"
|
||||
#include "GameFramework/CharacterMovementComponent.h"
|
||||
|
@ -81,21 +80,6 @@ void APlayerCharacter::BeginPlay()
|
|||
|
||||
AimSensitivity = DefaultAimSensitivity;
|
||||
|
||||
if (UNakatomiGameInstance* gameInstance = Cast<UNakatomiGameInstance>(UGameplayStatics::GetGameInstance(GetWorld())))
|
||||
{
|
||||
if (UNakatomiSaveGame* Save = gameInstance->GetSaveGameObject())
|
||||
{
|
||||
//TODO: More loading here
|
||||
GetHealthComponent()->SetCurrentHealth(Save->PlayerHealth);
|
||||
|
||||
if (Save->ThrowableInventory.Num() > 0)
|
||||
{
|
||||
ThrowableInventory.Empty();
|
||||
ThrowableInventory = Save->ThrowableInventory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->ActorHasTag(FName("Player")))
|
||||
{
|
||||
this->Tags.Add(FName("Player"));
|
||||
|
|
Loading…
Reference in New Issue