public class NavmeshManager : INavigation { public bool LoadScene(Stream binaryData); public bool ClearScene(); public bool FindPath(ref Listpath); } public interface INavigation { bool LoadScene(Stream binaryData); bool ClearScene(); bool FindPath(ref List path); } public class NavigationManager { public void Init(INavigation implement) { _implement = implement; } public bool FindPath(ref List path) { return _implement.FindPathEx(ref path); } public static readonly NavigationManager Instance = new NavigationManager(); private INavigation _implement = null; } public static class NavigationSafeOperation { public static bool FindPathEx(this INavigation navigation, ref List path) { if (navigation != null) { return navigation.FindPath(ref path); } else if (debugMode) { Console.Error.WriteLine("[INavigation.FindPathEx] navigation is null"); } return false; } public static bool debugMode { get; set; } }