IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    [原]C#插件范例代码

    kun1234567发表于 2014-12-10 21:16:21
    love 0
        public class NavmeshManager : INavigation
        {
            public bool LoadScene(Stream binaryData);
            public bool ClearScene();
            public bool FindPath(ref List path);
        }
    
    
        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; }
        }



沪ICP备19023445号-2号
友情链接