using System.Collections.Generic; using UnityEngine.Profiling; namespace Pathfinding.Util { public interface IGraphSnapshot : System.IDisposable { /// /// Restores the graph data to the state it had when the snapshot was taken, in the bounding box that the snapshot captured. /// /// You can get the context from the callback provided to the method. /// void Restore(IGraphUpdateContext ctx); } /// /// A snapshot of parts of graphs. /// /// See: /// public struct GraphSnapshot : IGraphSnapshot { List inner; internal GraphSnapshot (List inner) { this.inner = inner; } /// \copydocref{IGraphSnapshot.Restore} public void Restore (IGraphUpdateContext ctx) { Profiler.BeginSample("Restoring Graph Snapshot"); for (int i = 0; i < inner.Count; i++) { inner[i].Restore(ctx); } Profiler.EndSample(); } public void Dispose () { if (inner != null) { for (int i = 0; i < inner.Count; i++) { inner[i].Dispose(); } inner = null; } } } }