/// <summary> /// 加载当前场景的A*格子信息 /// </summary> public void LoadCurrentSceneAStarInfo(string _sceneName, Action _complete) { if (currSceneName == _sceneName) { if (null != _complete) { _complete(); return; } } currSceneName = _sceneName; var loader = astarLoaderCache.Get(_sceneName, null); if (null == loader) { loader = new AStarLoader(_sceneName, aStarRoot); loader.LoadAStartInfo(_complete); astarLoaderCache.Add(_sceneName, loader); } else { if (null != _complete) { _complete(); } } // 不需要等待加载完成,直接赋值 currAstartLoader = loader; }
/// <summary> /// 当a* start被动从cache中移被除时 /// </summary> /// <param name="_sceneName"></param> /// <param name="_aStarLoader"></param> private void AStarLoaderCacheOnOnRemoveLeastUsed(string _sceneName, AStarLoader _aStarLoader) { if (null != _aStarLoader) { _aStarLoader.Dispose(); } }