REname to AppleMachine

This commit is contained in:
Michal Pikulski
2025-11-03 10:36:56 +01:00
parent 54c9094be1
commit 3e343d074c
9 changed files with 19 additions and 19 deletions

View File

@@ -12,7 +12,7 @@ namespace Core.SaveLoad
/// Inherits from Pixelplacement.StateMachine and adds save/load functionality.
/// Use SaveableState (not State) for child states to get save/load hooks.
/// </summary>
public class SaveableStateMachine : StateMachine, ISaveParticipant
public class AppleMachine : StateMachine, ISaveParticipant
{
[SerializeField]
[Tooltip("Optional custom save ID. If empty, will auto-generate from scene name and hierarchy path.")]
@@ -36,7 +36,7 @@ namespace Core.SaveLoad
// If not restoring and change was successful, call OnEnterState
if (!IsRestoring && result != null && currentState != null)
{
var saveableState = currentState.GetComponent<SaveableState>();
var saveableState = currentState.GetComponent<AppleState>();
if (saveableState != null)
{
saveableState.OnEnterState();
@@ -53,7 +53,7 @@ namespace Core.SaveLoad
// If not restoring and change was successful, call OnEnterState
if (!IsRestoring && result != null && currentState != null)
{
var saveableState = currentState.GetComponent<SaveableState>();
var saveableState = currentState.GetComponent<AppleState>();
if (saveableState != null)
{
saveableState.OnEnterState();
@@ -70,7 +70,7 @@ namespace Core.SaveLoad
// If not restoring and change was successful, call OnEnterState
if (!IsRestoring && result != null && currentState != null)
{
var saveableState = currentState.GetComponent<SaveableState>();
var saveableState = currentState.GetComponent<AppleState>();
if (saveableState != null)
{
saveableState.OnEnterState();
@@ -158,8 +158,8 @@ namespace Core.SaveLoad
return JsonUtility.ToJson(new StateMachineSaveData { stateName = "", stateData = "" });
}
SaveableState saveableState = currentState.GetComponent<SaveableState>();
string stateData = saveableState?.SerializeState() ?? "";
AppleState appleState = currentState.GetComponent<AppleState>();
string stateData = appleState?.SerializeState() ?? "";
var saveData = new StateMachineSaveData
{
@@ -203,10 +203,10 @@ namespace Core.SaveLoad
// Now explicitly call OnRestoreState with the saved data
if (currentState != null)
{
SaveableState saveableState = currentState.GetComponent<SaveableState>();
if (saveableState != null)
AppleState appleState = currentState.GetComponent<AppleState>();
if (appleState != null)
{
saveableState.OnRestoreState(saveData.stateData);
appleState.OnRestoreState(saveData.stateData);
}
}

View File

@@ -6,7 +6,7 @@ namespace Core.SaveLoad
/// Base class for states that need save/load functionality.
/// Inherit from this instead of Pixelplacement.State for states in SaveableStateMachines.
/// </summary>
public class SaveableState : State
public class AppleState : State
{
/// <summary>
/// Called when this state is entered during normal gameplay.