First go around with save load system
This commit is contained in:
@@ -244,5 +244,36 @@ namespace Core
|
||||
|
||||
public IEnumerable<Pickup> Pickups => _pickups;
|
||||
public IEnumerable<ItemSlot> ItemSlots => _itemSlots;
|
||||
|
||||
/// <summary>
|
||||
/// Gets all registered pickups. Used by save/load system to find items by save ID.
|
||||
/// </summary>
|
||||
public IEnumerable<Pickup> GetAllPickups() => _pickups;
|
||||
|
||||
/// <summary>
|
||||
/// Gets all registered item slots. Used by save/load system.
|
||||
/// </summary>
|
||||
public IEnumerable<ItemSlot> GetAllItemSlots() => _itemSlots;
|
||||
|
||||
/// <summary>
|
||||
/// Finds a pickup by its save ID. Used by save/load system to restore item references.
|
||||
/// </summary>
|
||||
/// <param name="saveId">The save ID to search for</param>
|
||||
/// <returns>The pickup's GameObject if found, null otherwise</returns>
|
||||
public GameObject FindPickupBySaveId(string saveId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(saveId)) return null;
|
||||
|
||||
// Search through all registered pickups
|
||||
foreach (var pickup in _pickups)
|
||||
{
|
||||
if (pickup is SaveableInteractable saveable && saveable.GetSaveId() == saveId)
|
||||
{
|
||||
return pickup.gameObject;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user