public void InitMesher()
        {
            if (theme == null)
            {
                Debug.LogError("theme is null! drawer not initialized!");
                return;
            }

            if (theme.Is3DTheme)
            {
                if (drawer == null || drawer.Get <TileMesher3D>() == null)
                {
                    drawer?.Dispose();
                    drawer = MeshBuilderDrawer.Create <TileMesher3D>(renderInfo);
                }

                drawer.Get <TileMesher3D>().Init(tileData, themeIndex, theme, cellSize, Settings3D);
            }
            else
            {
                if (drawer == null || drawer.Get <TileMesher2D>() == null)
                {
                    drawer?.Dispose();
                    drawer = MeshBuilderDrawer.Create <TileMesher2D>(renderInfo);
                }

                drawer.Get <TileMesher2D>().Init(tileData, yLayer, themeIndex, theme);
            }
        }
 private void Awake()
 {
     drawer = theme.Is2DTheme ?
              MeshBuilderDrawer.Create <TileMesher2D>(renderInfo) :
              MeshBuilderDrawer.Create <TileMesher3D>(renderInfo);
     AddDrawer(drawer);
 }
Exemplo n.º 3
0
 public void RemoveDrawer(MeshBuilderDrawer drawer)
 {
     if (Drawers != null)
     {
         Drawers.Remove(drawer);
     }
 }
Exemplo n.º 4
0
 public bool DoesContain(MeshBuilderDrawer drawer)
 {
     if (Drawers != null)
     {
         return(Drawers.Contains(drawer));
     }
     return(false);
 }
Exemplo n.º 5
0
 public void AddDrawer(MeshBuilderDrawer drawer)
 {
     if (Drawers == null)
     {
         Drawers = new List <MeshBuilderDrawer>();
         Drawers.Add(drawer);
     }
     else
     {
         if (!DoesContain(drawer))
         {
             Drawers.Add(drawer);
         }
     }
 }
        public void Dispose()
        {
            if (drawer != null)
            {
                drawer.Dispose();
                drawer = null;
            }

            if (cachedTileData != null)
            {
                cachedTileData.Dispose();
                cachedTileData = null;
            }

            tileData = null;
        }