本文整理汇总了C#中BlockType.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# BlockType.Contains方法的具体用法?C# BlockType.Contains怎么用?C# BlockType.Contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockType
的用法示例。
在下文中一共展示了BlockType.Contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupBlockGenerator
/// <summary>
/// Setups the randomizer
/// </summary>
protected void SetupBlockGenerator(Boolean level_reset = false)
{
// Create empty Queue
if (level_reset)
_blockTypeQueue.Clear();
else
_blockTypeQueue = new List<BlockType>();
GenerateNextPermutation();
// First block of first bag is always I J L or T
var firstAllowed = new BlockType[] { BlockType.IBlock, BlockType.JBlock, BlockType.LBlock, BlockType.TBlock };
while (!firstAllowed.Contains(_blockTypeQueue.First()))
_blockTypeQueue.Push(_blockTypeQueue.UnShift<BlockType>());
// Generate as a block
if (level_reset)
this.CurrentBlock.Block.SetBlockType(_blockTypeQueue.UnShift<BlockType>());
else
this.CurrentBlock = new FallingBlock(this.Game, new Block(_blockTypeQueue.UnShift<BlockType>()), this);
this.CurrentBlock.Replace(
(this.Width - this.CurrentBlock.Block.Width) / 2 + Block.GetBaseXPosition(this.CurrentBlock.Block.Type),
this.CurrentBlock.Field.Height - 1,
Block.GetStartRotation(this.CurrentBlock.Block.Type)
);
// Set next block
if (level_reset)
this.NextBlock.SetBlockType(_blockTypeQueue.UnShift<BlockType>());
else
this.NextBlock = new Block(_blockTypeQueue.UnShift<BlockType>());
this.NextBlock.Rotation = Block.GetStartRotation(this.NextBlock.Type);
}