public class NavmeshManager : INavigation
{
public bool LoadScene(Stream binaryData);
public bool ClearScene();
public bool FindPath(ref List<Vector3> path);
}
public interface INavigation
{
bool LoadScene(Stream binaryData);
bool ClearScene();
bool FindPath(ref List<Vector3> path);
}
public class NavigationManager
{
public void Init(INavigation implement)
{
_implement = implement;
}
public bool FindPath(ref List<Vector3> 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<Vector3> 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; }
}
C#插件范例代码
最新推荐文章于 2022-11-19 14:32:59 发布