MapModuleBuilder.cs 936 B

12345678910111213141516171819202122232425262728
  1. using UnityEngine;
  2. using XGame.Framework.Asset;
  3. using XGame.Framework.Quality;
  4. using XGame.Framework.Time;
  5. namespace XGame.Framework.Map
  6. {
  7. public class MapModuleBuilder
  8. {
  9. public IMapModule Product { get; private set; }
  10. public void Build(IQualityModule qualityModule, ITimeModule timeModule)
  11. {
  12. var assetModule = new AssetModule();
  13. var root = CreateRoot();
  14. var mapModule = new MapModule(assetModule, root);
  15. var context = new MapContext(qualityModule, timeModule, mapModule);
  16. (mapModule as IMapContextSetter).Context = context;
  17. Product = mapModule;
  18. }
  19. private Transform CreateRoot()
  20. {
  21. var go = new GameObject("MapRoot");
  22. go.transform.SetParent(AppManager.Root, false);
  23. go.transform.localPosition = new Vector3(0, 100, 0);
  24. return go.transform;
  25. }
  26. }
  27. }