public static void TakeSnapshots(ISnapshotContainer container, IReadOnlyDictionary <ItemID, Item> items) { container.Items = items.Values .Where(item => item is not Flashlight) .Select(item => item.TakeSnapshot()) .ToArray(); container.Flashlight = (items[ItemID.Flashlight] as Flashlight)?.TakeSnapshot(); }
public static bool RestoreSnapshots(ISnapshotContainer container, IReadOnlyDictionary <ItemID, Item> items) { bool result = true; if (container.Items != null) { foreach (var item in container.Items) { result &= items ![item.ID].RestoreSnapshot(item);
public static bool RestoreSnapshots(ISnapshotContainer container, IReadOnlyDictionary <AnimateID, Animate> animates) { if (container.Animates == null) { return(false); } bool result = true; foreach (var animate in container.Animates) { result &= animates[animate.ID].RestoreSnapshot(animate); } return(result); }
public static void TakeSnapshots(ISnapshotContainer container, IReadOnlyDictionary <AnimateID, Animate> animates) => container.Animates = animates.Values .Select(animate => animate.TakeSnapshot()) .ToArray();