LoadTileAsyncManager.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using AIPagedLod;
  5. public class LoadTileAsyncManager : MonoBehaviour
  6. {
  7. public static LoadTileAsyncManager mInstance;
  8. public int mCurrentCoroutineCount = 0;
  9. void Awake()
  10. {
  11. mInstance = this;
  12. }
  13. public void StartLoadChildTile(PagedLod pagedLod, PagedLodFileLoader pagedLodLoader, PagedLodInfo pagedLodInfo)
  14. {
  15. mCurrentCoroutineCount++;
  16. StartCoroutine(LoadChildTileAsync( pagedLod, pagedLodLoader, pagedLodInfo));
  17. }
  18. public IEnumerator LoadChildTileAsync(PagedLod pagedLod, PagedLodFileLoader pagedLodLoader, PagedLodInfo pagedLodInfo)
  19. {
  20. pagedLod.LoadTilePagedLod(pagedLodInfo,pagedLodLoader);
  21. pagedLodLoader.Dispose();
  22. pagedLodLoader = null;
  23. yield return null;
  24. mCurrentCoroutineCount--;
  25. }
  26. public void StartLoadRenderNode(PagedLod pagedLod, PagedLodFileLoader pagedLodLoader)
  27. {
  28. StartCoroutine(LoadRenderNode(pagedLod, pagedLodLoader));
  29. }
  30. public IEnumerator LoadRenderNode(PagedLod pagedLod, PagedLodFileLoader pagedLodLoader)
  31. {
  32. pagedLod.LoadRenderNode(pagedLodLoader);
  33. pagedLodLoader.Dispose();
  34. pagedLodLoader = null;
  35. yield return null;
  36. }
  37. }