Exemple #1
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);
        }
Exemple #2
0
        /// <summary>
        /// Возвращает матрицу текущего шаблона
        /// </summary>
        /// <returns></returns>
        public ChunkTemplates.Template GetTemplateMatrix()
        {
            Debug.Log("Chunk GetTemplateMatrix");
            ChunkTemplates.Template template = new ChunkTemplates.Template();
            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.chunkWidth + k] = block;
                }
            }
            template.ttype = currentTemplate.ttype;

            template.topExit    = currentTemplate.topExit;
            template.bottomExit = currentTemplate.bottomExit;
            template.leftExit   = currentTemplate.leftExit;
            template.rightExit  = currentTemplate.rightExit;

            return(template);
        }