Beispiel #1
0
        private static void UpdateTile_OnTileApplied(TerrainTile tile, Products.TileData tileData, Products.StopToken stop)
        {
            Terrain terrain = tile.GetTerrain(tileData.isDraft);

            if (terrain == null)
            {
                return;                                      //seems to be happen when stopping playmode while tile generating
            }
            if (!terrainLinesCache.TryGetValue(terrain, out PolyLine polyLine))
            {
                polyLine = CreateTerrainLine(terrain);
                terrainLinesCache.Add(terrain, polyLine);
            }

            else
            {
                Vector3[] lineArr = CreateLinePoints(terrain);
                if (polyLine.MaxPoints < lineArr.Length)
                {
                    polyLine = CreateTerrainLine(terrain);
                    terrainLinesCache.Remove(terrain);
                    terrainLinesCache.Add(terrain, polyLine);
                }

                else
                {
                    polyLine.SetPoints(lineArr);
                }
            }
        }
        private static void UpdateTile_OnTileApplied(TerrainTile tile, Products.TileData tileData, Products.StopToken stop)
        {
            Terrain terrain = tile.GetTerrain(tileData.isDraft);

            if (!terrainLinesCache.TryGetValue(terrain, out PolyLine polyLine))
            {
                polyLine = CreateTerrainLine(terrain);
                terrainLinesCache.Add(terrain, polyLine);
            }

            else
            {
                Vector3[] lineArr = CreateLinePoints(terrain);
                if (polyLine.MaxPoints < lineArr.Length)
                {
                    polyLine = CreateTerrainLine(terrain);
                    terrainLinesCache.Remove(terrain);
                    terrainLinesCache.Add(terrain, polyLine);
                }

                else
                {
                    polyLine.SetPoints(lineArr);
                }
            }
        }