From 3e343d074cf742cb3975cbcbdd925ae02e146889 Mon Sep 17 00:00:00 2001 From: Michal Pikulski Date: Mon, 3 Nov 2025 10:36:56 +0100 Subject: [PATCH] REname to AppleMachine --- Assets/Editor/StateMachineMigrationTool.cs | 10 +++++----- .../Scripts/Animation/GardenerChaseBehavior.cs | 2 +- ...SaveableStateMachine.cs => AppleMachine.cs} | 18 +++++++++--------- ...ateMachine.cs.meta => AppleMachine.cs.meta} | 0 .../{SaveableState.cs => AppleState.cs} | 2 +- ...aveableState.cs.meta => AppleState.cs.meta} | 0 .../LawnMowerPuzzle/GardenerBehaviour.cs | 2 +- .../LawnMowerPuzzle/LawnMowerBehaviour.cs | 2 +- .../LawnMowerPuzzle/LawnMowerChaseBehaviour.cs | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) rename Assets/Scripts/Core/SaveLoad/{SaveableStateMachine.cs => AppleMachine.cs} (91%) rename Assets/Scripts/Core/SaveLoad/{SaveableStateMachine.cs.meta => AppleMachine.cs.meta} (100%) rename Assets/Scripts/Core/SaveLoad/{SaveableState.cs => AppleState.cs} (97%) rename Assets/Scripts/Core/SaveLoad/{SaveableState.cs.meta => AppleState.cs.meta} (100%) diff --git a/Assets/Editor/StateMachineMigrationTool.cs b/Assets/Editor/StateMachineMigrationTool.cs index c42a00d8..d3fe70c4 100644 --- a/Assets/Editor/StateMachineMigrationTool.cs +++ b/Assets/Editor/StateMachineMigrationTool.cs @@ -157,7 +157,7 @@ namespace Editor var componentType = component.GetType(); if (componentType.Name == "StateMachine" && componentType.Namespace == "Pixelplacement") { - bool isAlreadySaveable = component is SaveableStateMachine; + bool isAlreadySaveable = component is AppleMachine; foundStateMachines.Add(new StateMachineInfo { name = component.gameObject.name, @@ -189,7 +189,7 @@ namespace Editor var componentType = component.GetType(); if (componentType.Name == "StateMachine" && componentType.Namespace == "Pixelplacement") { - bool isAlreadySaveable = component is SaveableStateMachine; + bool isAlreadySaveable = component is AppleMachine; foundStateMachines.Add(new StateMachineInfo { name = component.gameObject.name, @@ -336,7 +336,7 @@ namespace Editor var componentType = component.GetType(); if (componentType.Name == "StateMachine" && componentType.Namespace == "Pixelplacement" && - !(component is SaveableStateMachine)) + !(component is AppleMachine)) { if (MigrateComponent(component.gameObject, component)) { @@ -369,7 +369,7 @@ namespace Editor var componentType = component.GetType(); if (componentType.Name == "StateMachine" && componentType.Namespace == "Pixelplacement" && - !(component is SaveableStateMachine)) + !(component is AppleMachine)) { bool success = MigrateComponent(gameObject, component); @@ -412,7 +412,7 @@ namespace Editor Object.DestroyImmediate(oldComponent); // Add new component - var newSM = gameObject.AddComponent(); + var newSM = gameObject.AddComponent(); // Restore data using SerializedObject SerializedObject newSO = new SerializedObject(newSM); diff --git a/Assets/Scripts/Animation/GardenerChaseBehavior.cs b/Assets/Scripts/Animation/GardenerChaseBehavior.cs index 859f7dcf..b90a8466 100644 --- a/Assets/Scripts/Animation/GardenerChaseBehavior.cs +++ b/Assets/Scripts/Animation/GardenerChaseBehavior.cs @@ -6,7 +6,7 @@ using Core.SaveLoad; using Pixelplacement; using UnityEngine.Serialization; -public class GardenerChaseBehavior : SaveableState +public class GardenerChaseBehavior : AppleState { private static readonly int Property = Animator.StringToHash("IsIdle?"); public Spline chaseSpline; diff --git a/Assets/Scripts/Core/SaveLoad/SaveableStateMachine.cs b/Assets/Scripts/Core/SaveLoad/AppleMachine.cs similarity index 91% rename from Assets/Scripts/Core/SaveLoad/SaveableStateMachine.cs rename to Assets/Scripts/Core/SaveLoad/AppleMachine.cs index 9fd60fec..1bbe3576 100644 --- a/Assets/Scripts/Core/SaveLoad/SaveableStateMachine.cs +++ b/Assets/Scripts/Core/SaveLoad/AppleMachine.cs @@ -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. /// - 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(); + var saveableState = currentState.GetComponent(); 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(); + var saveableState = currentState.GetComponent(); 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(); + var saveableState = currentState.GetComponent(); if (saveableState != null) { saveableState.OnEnterState(); @@ -158,8 +158,8 @@ namespace Core.SaveLoad return JsonUtility.ToJson(new StateMachineSaveData { stateName = "", stateData = "" }); } - SaveableState saveableState = currentState.GetComponent(); - string stateData = saveableState?.SerializeState() ?? ""; + AppleState appleState = currentState.GetComponent(); + 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(); - if (saveableState != null) + AppleState appleState = currentState.GetComponent(); + if (appleState != null) { - saveableState.OnRestoreState(saveData.stateData); + appleState.OnRestoreState(saveData.stateData); } } diff --git a/Assets/Scripts/Core/SaveLoad/SaveableStateMachine.cs.meta b/Assets/Scripts/Core/SaveLoad/AppleMachine.cs.meta similarity index 100% rename from Assets/Scripts/Core/SaveLoad/SaveableStateMachine.cs.meta rename to Assets/Scripts/Core/SaveLoad/AppleMachine.cs.meta diff --git a/Assets/Scripts/Core/SaveLoad/SaveableState.cs b/Assets/Scripts/Core/SaveLoad/AppleState.cs similarity index 97% rename from Assets/Scripts/Core/SaveLoad/SaveableState.cs rename to Assets/Scripts/Core/SaveLoad/AppleState.cs index d9f62c2c..14a746d1 100644 --- a/Assets/Scripts/Core/SaveLoad/SaveableState.cs +++ b/Assets/Scripts/Core/SaveLoad/AppleState.cs @@ -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. /// - public class SaveableState : State + public class AppleState : State { /// /// Called when this state is entered during normal gameplay. diff --git a/Assets/Scripts/Core/SaveLoad/SaveableState.cs.meta b/Assets/Scripts/Core/SaveLoad/AppleState.cs.meta similarity index 100% rename from Assets/Scripts/Core/SaveLoad/SaveableState.cs.meta rename to Assets/Scripts/Core/SaveLoad/AppleState.cs.meta diff --git a/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/GardenerBehaviour.cs b/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/GardenerBehaviour.cs index b97d784d..19ae308f 100644 --- a/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/GardenerBehaviour.cs +++ b/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/GardenerBehaviour.cs @@ -5,7 +5,7 @@ using Pixelplacement; using UnityEngine; -public class GardenerBehaviour : SaveableStateMachine +public class GardenerBehaviour : AppleMachine { public void stateSwitch (string StateName) { diff --git a/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/LawnMowerBehaviour.cs b/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/LawnMowerBehaviour.cs index 61879566..34f050d9 100644 --- a/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/LawnMowerBehaviour.cs +++ b/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/LawnMowerBehaviour.cs @@ -2,7 +2,7 @@ using Core; using Core.SaveLoad; using Pixelplacement; -public class LawnMowerBehaviour : SaveableStateMachine +public class LawnMowerBehaviour : AppleMachine { public void mowerTouched() { diff --git a/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/LawnMowerChaseBehaviour.cs b/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/LawnMowerChaseBehaviour.cs index cf45c45f..a7b299f8 100644 --- a/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/LawnMowerChaseBehaviour.cs +++ b/Assets/Scripts/DamianExperiments/LawnMowerPuzzle/LawnMowerChaseBehaviour.cs @@ -2,7 +2,7 @@ using Core.SaveLoad; using UnityEngine; using Pixelplacement; -public class LawnMowerChaseBehaviour : SaveableState +public class LawnMowerChaseBehaviour : AppleState { public Spline ChaseSpline; public Transform LawnMowerObject;