当前位置: 首页>>代码示例>>C#>>正文


C# Block.GetLength方法代码示例

本文整理汇总了C#中Block.GetLength方法的典型用法代码示例。如果您正苦于以下问题:C# Block.GetLength方法的具体用法?C# Block.GetLength怎么用?C# Block.GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Block的用法示例。


在下文中一共展示了Block.GetLength方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReplaceGround

        public override void ReplaceGround(BiomeData bd, Block[, ,] blocks)
        {
            for (int x = 0; x < blocks.GetLength(0); x++)
                for (int y = 0; y < blocks.GetLength(1); y++)
                    if (this.SuitableSampleAverage(bd, x, y))
                        for (int z = 0; z < blocks.GetLength(2); z++)
                            if (blocks[x, y, z] == Block.GrassBlock)
                                blocks[x, y, z] = Block.SandGrassBlock;

            base.ReplaceGround(bd, blocks);
        }
开发者ID:EgoIncarnate,项目名称:Tychaia,代码行数:11,代码来源:GrassDesertBiome.cs

示例2: ToRealChunk

 public static Chunk ToRealChunk(int[,] chunkAsNumbers, int chunkOffset)
 {
     if (chunkLoader==null) chunkLoader=GameObject.Find("ChunkLoader").GetComponent<ChunkLoader>();
     Block[,] blocks=new Block[chunkLoader.CHUNK_WIDTH, chunkLoader.MAX_SKY_HEIGHT-chunkLoader.BEDROCK_LEVEL];
     for (int x=0; x<blocks.GetLength(0); x++) {
         for (int y=0; y<blocks.GetLength(1); y++) {
             Vector3 blockPosition=new Vector3(x+chunkLoader.CHUNK_WIDTH*chunkOffset, y+chunkLoader.BEDROCK_LEVEL, 0);
             blocks[x, y]=(Block)Instantiate(chunkLoader.blockPrefabs[chunkAsNumbers[x, y]],  blockPosition, Quaternion.identity);
         }
     }
     Chunk toReturn=(Chunk)Instantiate(chunkLoader.chunkPrefab, new Vector3(0, 0, 0), Quaternion.identity);
     toReturn.setBlocks(blocks, chunkOffset);
     return toReturn;
 }
开发者ID:WumboGames,项目名称:UnityBackup,代码行数:14,代码来源:Chunk.cs

示例3: CheckSolid

	protected override bool CheckSolid(Block[,,] blocks, int x, int y, int z, Direction direction) {
		if (x < 0 || x > blocks.GetLength(0) - 1) {
			return true;
		}
		if (y < 0 || y > blocks.GetLength(1) - 1) {
			return true;
		}
		if (z < 0 || z > blocks.GetLength(2) - 1) {
			return true;
		}

		if (direction == Direction.Down) {
			return true;
		}
		return !(blocks[x, y, z].GetSolidity(direction) == BlockSolidity.Block || blocks[x, y, z].GetSolidity(direction) == BlockSolidity.Floor);
	}
开发者ID:platformed,项目名称:Platformed-Game,代码行数:16,代码来源:FloorBlock.cs

示例4: SerializeToString

    public static string SerializeToString(Block[,,] array)
    {
        var charArray = new char[array.GetLength(0),array.GetLength(1),array.GetLength(2)];
        for(int z = 0; z < array.GetLength(2); z++)
        {
            for(int y = 0; y < array.GetLength(1); y++)
            {
                for(int x = 0; x < array.GetLength(0); x++)
                {
                    if(array[x,y,z] != null)
                    {
                        charArray[x,y,z] = array[x,y,z].ToChar();
                    }
                    else
                    {
                        charArray[x,y,z] = '_';
                    }
                }
            }
        }

        return SerializeToString(charArray);
    }
开发者ID:akshatg,项目名称:BrainStrain,代码行数:23,代码来源:Parser.cs

示例5: LoadBlocks

 void LoadBlocks(Block[,] blocks, uint startX, uint startY, bool silverBot, uint startSilverBotX, uint startSilverBotY)
 {
     if (silverBot)
     {
         blocks[startSilverBotX, startSilverBotY] = (Block)0xFE;
         blocks[startSilverBotX + 1, startSilverBotY] = (Block)0xFD;
         blocks[startSilverBotX, startSilverBotY + 1] = (Block)0xFD;
         blocks[startSilverBotX + 1, startSilverBotY + 1] = (Block)0xFE;
     }
     blocks[startX, startY] = (Block)0xFF;
     textBox1.Text = "";
     for (int y = 0; y < blocks.GetLength(1); y++)
     {
         for (int x = 0; x < blocks.GetLength(0); x++)
         {
             Block current = blocks[x, y];
             char currentChar = ParseBlock(current);
             textBox1.Text += currentChar;
         }
         if (y < blocks.GetLength(1) - 1)
             textBox1.Text += "\r\n";
     }
 }
开发者ID:michaelcheers,项目名称:SilverBotAndGuy,代码行数:23,代码来源:Form1.cs

示例6: CheckSolid

	/// <summary>
	/// Checks if a blocks face is solid in a ceratian direction from a block array
	/// </summary>
	/// <param name="blocks">Block array to check from</param>
	/// <param name="x">X position of block</param>
	/// <param name="y">Y position of block</param>
	/// <param name="z">Z position of block</param>
	/// <param name="direction">Direction to check</param>
	/// <returns>True if the block is not solid</returns>
	protected virtual bool CheckSolid(Block[,,] blocks, int x, int y, int z, Direction direction) {
		if (x < 0 || x > blocks.GetLength(0) - 1) {
			return false;
		}
		if (y < 0 || y > blocks.GetLength(1) - 1) {
			return false;
		}
		if (z < 0 || z > blocks.GetLength(2) - 1) {
			return false;
		}

		return blocks[x, y, z].GetSolidity(direction) == BlockSolidity.Block;
	}
开发者ID:platformed,项目名称:Platformed-Game,代码行数:22,代码来源:Block.cs


注:本文中的Block.GetLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。