當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。