Add campfire persistence state
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Copyright Pacificao. All Rights Reserved.
|
||||
|
||||
#include "AgrarianPersistentActorComponent.h"
|
||||
#include "AgrarianPersistentStateProvider.h"
|
||||
|
||||
UAgrarianPersistentActorComponent::UAgrarianPersistentActorComponent()
|
||||
{
|
||||
@@ -14,6 +15,13 @@ bool UAgrarianPersistentActorComponent::IsSaveable() const
|
||||
|
||||
FAgrarianSavedWorldActor UAgrarianPersistentActorComponent::CaptureSaveState() const
|
||||
{
|
||||
if (const AActor* Owner = GetOwner(); Owner && Owner->Implements<UAgrarianPersistentStateProvider>())
|
||||
{
|
||||
IAgrarianPersistentStateProvider::Execute_CapturePersistentState(
|
||||
const_cast<AActor*>(Owner),
|
||||
const_cast<UAgrarianPersistentActorComponent*>(this));
|
||||
}
|
||||
|
||||
FAgrarianSavedWorldActor SavedActor;
|
||||
SavedActor.ActorTypeId = ActorTypeId;
|
||||
SavedActor.StringState = StringState;
|
||||
@@ -41,4 +49,9 @@ void UAgrarianPersistentActorComponent::ApplySaveState(const FAgrarianSavedWorld
|
||||
{
|
||||
GetOwner()->SetActorTransform(SavedActor.Transform);
|
||||
}
|
||||
|
||||
if (AActor* Owner = GetOwner(); Owner && Owner->Implements<UAgrarianPersistentStateProvider>())
|
||||
{
|
||||
IAgrarianPersistentStateProvider::Execute_ApplyPersistentState(Owner, this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user