Factory puzzle feedback and VO
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
using Core;
|
||||
using Core.Lifecycle;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class FactoryGameStats : ManagedBehaviour
|
||||
{
|
||||
public int partsFoundInLevel;
|
||||
|
||||
// Save system configuration
|
||||
public override bool AutoRegisterForSave => true;
|
||||
|
||||
internal override void OnManagedStart()
|
||||
{
|
||||
// Initialize after all managers are ready
|
||||
}
|
||||
|
||||
public void PartFound()
|
||||
{
|
||||
partsFoundInLevel += 1;
|
||||
}
|
||||
|
||||
#region Save/Load Lifecycle Hooks
|
||||
|
||||
internal override string OnSceneSaveRequested()
|
||||
{
|
||||
// Save scene-specific progress
|
||||
var state = new BirdGameState
|
||||
{
|
||||
birdsFoundInLevel = this.partsFoundInLevel
|
||||
};
|
||||
return JsonUtility.ToJson(state);
|
||||
}
|
||||
|
||||
internal override void OnSceneRestoreRequested(string serializedData)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serializedData))
|
||||
{
|
||||
// No saved data, keep default values
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var state = JsonUtility.FromJson<BirdGameState>(serializedData);
|
||||
if (state != null)
|
||||
{
|
||||
partsFoundInLevel = state.birdsFoundInLevel;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.Warning($"[BirdGameStats] Failed to restore state: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializable state for bird game progress
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class BirdGameState
|
||||
{
|
||||
public int birdsFoundInLevel;
|
||||
}
|
||||
Reference in New Issue
Block a user