本文整理汇总了C#中Block.Init方法的典型用法代码示例。如果您正苦于以下问题:C# Block.Init方法的具体用法?C# Block.Init怎么用?C# Block.Init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Block
的用法示例。
在下文中一共展示了Block.Init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpawnBlock
//--------------------------------------------------------------------------
void SpawnBlock()
{
//Create next block
mActiveBlock = new Block();
int halfSize = (int)(mBlocksData[mNextBlockType].mSize / 2);
Vector3 startPosition = new Vector3(mStartPosition.x - halfSize, mStartPosition.y, 0);
mActiveBlock.Init(mBlocksData[mNextBlockType], mBlockPrefab, startPosition, mNextBlockColor);
//Check the if game is finished
if (CheckCollide()) {
FinishGame();
}
else {
GenerateNextBlockType(); // Get next block type
if (mPreviewBlock != null) // Destroy the previous preview
mPreviewBlock.Destroy();
mPreviewBlock = new Block();
mPreviewBlock.Init(mBlocksData[mNextBlockType], mBlockPrefab, mPreviewPosition, mNextBlockColor);
}
}
示例2: world_copy
void world_copy(object sender, System.EventArgs e)
{
if (sender == this.elementCopy)
{
if (editMode == EditMode.Monster)
{
undoWorld = new World(world);
Monster newMonster = new Monster(selectedMonster);
newMonster.Init();
selectedFace.monsters.Add(newMonster);
}
if (editMode == EditMode.Block)
{
undoWorld = new World(world);
Block newBlock = new Block(selectedBlock);
newBlock.Init();
selectedFace.blocks.Add(newBlock);
}
if (editMode == EditMode.Doodad)
{
undoWorld = new World(world);
Doodad newDoodad = new Doodad(selectedDoodad);
newDoodad.Init();
selectedFace.doodads.Add(newDoodad);
}
if (editMode == EditMode.Decoration)
{
undoWorld = new World(world);
Decoration newDecoration = new Decoration(selectedDecoration);
newDecoration.Init();
selectedFace.decorations.Add(newDecoration);
}
}
}