本文整理汇总了C#中BlockType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# BlockType.ToString方法的具体用法?C# BlockType.ToString怎么用?C# BlockType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockType
的用法示例。
在下文中一共展示了BlockType.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BaseBlock
public BaseBlock(DestructionXNA game, Model model, BlockType type)
: base(game)
{
this.game = game;
this.model = model;
this.type = type;
physicsObject = new PhysicsObject(type.ToString());
CreatePhysicsBody();
physicsObject.Body.AllowFreezing = true;
}
示例2: SetBlockAt
public void SetBlockAt(int x, int y, int z, BlockType block) {
print("Adding Block: " + x + ", " + y + ", " + z + ", " + block.ToString());
world.data [x, y, z] = block;
UpdateChunkAt (x, y, z);
}
示例3: GetBlockTypeName
public string GetBlockTypeName(BlockType blockType)
{
if (blockType < 0 || (int)blockType >= TerrariaUtils.BlockType_Max)
throw new ArgumentException(string.Format("The block type \"{0}\" is invalid.", blockType), "blockType");
return blockType.ToString();
}
示例4: GetItemTypeFromBlockType
public ItemType GetItemTypeFromBlockType(BlockType blockType, int objectStyle = 0)
{
if ((int)blockType < TerrariaUtils.BlockType_Min || (int)blockType > TerrariaUtils.BlockType_Max)
throw new ArgumentException(string.Format("The given block type {0} is invalid.", blockType), "blockType");
if (TerrariaItems.blockTypesItemTypes == null) {
TerrariaItems.blockTypesItemTypes = new ItemType[TerrariaUtils.ItemType_Max + 1][];
for (int i = TerrariaUtils.ItemType_Min; i < TerrariaUtils.ItemType_Max + 1; i++) {
Item dummyItem = new Item();
dummyItem.netDefaults(i);
if (!string.IsNullOrEmpty(dummyItem.name) && dummyItem.createTile != -1) {
ItemType[] styleArray = TerrariaItems.blockTypesItemTypes[dummyItem.createTile];
ItemType[] newStyleArray;
if (styleArray != null) {
newStyleArray = new ItemType[Math.Max(dummyItem.placeStyle + 1, styleArray.Length)];
styleArray.CopyTo(newStyleArray, 0);
} else {
newStyleArray = new ItemType[dummyItem.placeStyle + 1];
}
newStyleArray[dummyItem.placeStyle] = (ItemType)i;
TerrariaItems.blockTypesItemTypes[dummyItem.createTile] = newStyleArray;
}
}
}
{
switch (blockType) {
case BlockType.Mannequin:
return ItemType.Mannequin;
case BlockType.DartTrap:
return ItemType.DartTrap;
case BlockType.IceBlock:
return ItemType.None;
default: {
ItemType[] styleArray = TerrariaItems.blockTypesItemTypes[(int)blockType];
Contract.Assert(styleArray != null, "BlockType: " + blockType.ToString());
if (objectStyle >= styleArray.Length)
throw new ArgumentException(string.Format("There is no item type for block \"{0}\" with object style {1}", blockType, objectStyle));
return styleArray[objectStyle];
}
}
}
}