Example #1
0
 /// <summary>
 /// Применение темплейта на чанк
 /// </summary>
 /// <param name="template"></param>
 void SetTemplate(ChunkTemplates.ObstacleTemplate template)
 {
     currentObstacleTemplate = template;
     for (int y = 0; y < ChunkTemplates.obstacleHeight; y++)
     {
         for (int x = 0; x < ChunkTemplates.obstacleWidth; x++)
         {
             mapGenBlocks[y][x].SetBlockType(template.elements[y * ChunkTemplates.obstacleWidth + x].ttype);
         }
     }
 }
Example #2
0
        public ChunkTemplates.ObstacleTemplate GetTemplate()
        {
            ChunkTemplates.ObstacleTemplate template = new ChunkTemplates.ObstacleTemplate();

            for (int i = 0; i < mapGenBlocks.Length; i++)
            {
                for (int k = 0; k < mapGenBlocks[i].Length; k++)
                {
                    ChunkTemplates.Block block = new ChunkTemplates.Block();
                    block.ttype       = mapGenBlocks[i][k].blockType;
                    block.coordinates = new Vector2Int(k, i);

                    template.elements[i * ChunkTemplates.obstacleWidth + k] = block;
                }
            }

            return(template);
        }