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


C# BlockType.ToString方法代码示例

本文整理汇总了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;
        }
开发者ID:Sweetwater,项目名称:DestructionXNA,代码行数:11,代码来源:BaseBlock.cs

示例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);
	}
开发者ID:bpgeck,项目名称:Voxelnauts,代码行数:5,代码来源:ModifyTerrainEditor.cs

示例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();
        }
开发者ID:UB1AFU,项目名称:PluginCommonLibrary,代码行数:7,代码来源:TerrariaTiles.cs

示例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];
              }
            }
              }
        }
开发者ID:CoderCow,项目名称:PluginCommonLibrary,代码行数:48,代码来源:TerrariaItems.cs


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