Exemplo n.º 1
0
 protected virtual void setBlockLayerFromHeight(Block.Block _Block, int _Height, int _MaxHeight)
 {
     if (_Height < 20)
     {
         _Block.setFirstLayer(BlockEnum.Water);
     }
     else if (_Height > 40)
     {
         _Block.setFirstLayer(BlockEnum.Wall);
     }
 }
Exemplo n.º 2
0
        // 0 == Wall ! 1 == Floor  ! 2 == StairUp ! 3 == Treasure
        private void generateDungeon(int _Width, int _Heigth)
        {
            int var_Width  = _Width * 10;
            int var_Heigth = _Heigth * 10;

            int[,] var_Map = this.generateMap(var_Width, var_Heigth, 5);
            this.placeStairUp(var_Width, var_Heigth, var_Map);
            this.placeTreasure(var_Width, var_Heigth, var_Map);
            for (int x = 0; x < var_Width; x++)
            {
                for (int y = 0; y < var_Heigth; y++)
                {
                    if (var_Map[x, y] == 0)
                    {
                        Block.Block var_Block = this.getBlockAtCoordinate(this.Position + new Vector3(x, y, 0) * Block.Block.BlockSize);
                        var_Block.setFirstLayer(BlockEnum.Ground2);
                    }
                    else if (var_Map[x, y] == 1)
                    {
                        Block.Block var_Block = this.getBlockAtCoordinate(this.Position + new Vector3(x, y, 0) * Block.Block.BlockSize);
                        var_Block.setFirstLayer(BlockEnum.Ground1);
                    }
                    else if (var_Map[x, y] == 2)
                    {
                        Block.Block var_Block = this.getBlockAtCoordinate(this.Position + new Vector3(x, y, 0) * Block.Block.BlockSize);
                        var_Block.setFirstLayer(BlockEnum.Ground1);
                        //var_Block.DrawColor = Color.Green;
                    }
                    else if (var_Map[x, y] == 3)
                    {
                        Block.Block var_Block = this.getBlockAtCoordinate(this.Position + new Vector3(x, y, 0) * Block.Block.BlockSize);
                        //var_Block = new Block.Blocks.TeleportBlock(this.Position + new Vector3(x, y, 0) * Block.Block.BlockSize, BlockEnum.Ground1, (Chunk.Chunk)var_Block.Parent, this.Position + new Vector3(x, y, 0) * Block.Block.BlockSize, false, 0);
                        var_Block.setFirstLayer(BlockEnum.Ground1);
                        //var_Block.DrawColor = Color.Yellow;
                        this.setBlockAtCoordinate(this.Position + new Vector3(x, y, 0) * Block.Block.BlockSize, var_Block);
                        this.Exits.Add(var_Block);
                    }
                }
            }
        }