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


C# BlockType类代码示例

本文整理汇总了C#中BlockType的典型用法代码示例。如果您正苦于以下问题:C# BlockType类的具体用法?C# BlockType怎么用?C# BlockType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BlockType类属于命名空间,在下文中一共展示了BlockType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MatchResult

 public MatchResult(Pattern pattern, int x, int y, BlockType type)
 {
     this.pattern = pattern;
     this.x = x;
     this.y = y;
     this.type = type;
 }
开发者ID:pb0,项目名称:ID0_Test,代码行数:7,代码来源:Solver.cs

示例2: ReadBlock

 public static void ReadBlock(Stream stream, out BlockType blockType, out byte[] data)
 {
     blockType = (BlockType)stream.ReadByte();
     var sizeBuffer = stream.ReadBytes(2);
     var size = (ushort)(sizeBuffer[0] | sizeBuffer[1] << 8);
     data = stream.ReadBytes(size - 2);
 }
开发者ID:ha-tam,项目名称:TeraDamageMeter,代码行数:7,代码来源:_BlockHelper.cs

示例3: CanPlaceBlock

    public bool CanPlaceBlock(BlockType type, int[] chunkCoord, int[] blockCoord)
    {
        // Check first to see if we are attempting one of the overlap blocks that techinically "belongs" to the next chunk over
        bool changed = false;
        if (blockCoord[0] == Settings.CHUNK_SIZE)   // x is actually in the next chunk
        {
          chunkCoord[0]++;
          blockCoord[0] = 0;
          changed = true;
        }
        if (blockCoord[1] == Settings.CHUNK_SIZE)
        {
          chunkCoord[1]++;
          blockCoord[1] = 0;
          changed = true;
        }
        if (blockCoord[2] == Settings.CHUNK_SIZE)
        {
          chunkCoord[2]++;
          blockCoord[2] = 0;
          changed = true;
        }

        if (changed)
          return CanPlaceBlock(type, chunkCoord, blockCoord);

        Chunk c;

        if (!allChunks.TryGetValue(Util.CoordsToString(chunkCoord), out c))
          return false;    // No chunk found

        return true;
    }
开发者ID:cjcurrie,项目名称:Pillars,代码行数:33,代码来源:ChunkController.cs

示例4: ExportJson

 public void ExportJson()
 {
     var blockType = new BlockType { Name = "Foo" };
     var result = blockType.ToJson();
     const string key = "\"Name\": \"Foo\"";
     Assert.NotEqual( result.IndexOf( key ), -1 );
 }
开发者ID:NewSpring,项目名称:Rock,代码行数:7,代码来源:BlockTypeTests.cs

示例5: GraphSearch

    /// <summary>
    /// Give the start position of the agent and a goal, provide the Maze and a container to handle the pathfinding. can give different containers implementing IContainer interface
    /// to have different search results
    /// </summary>
    /// <param name="pos">Start position</param>
    /// <param name="GoalNode">Goal position</param>
    /// <param name="Grid">The Maze Grid</param>
    /// <param name="frontier">Container to use (i.e. Stack, Queue, PriorityQueue)</param>
    /// <returns></returns>
    public List<BlockPosition> GraphSearch(Node pos, Node GoalNode, BlockType[,] Grid, datastructures.IContainer<Node> frontier)
    {
        frontier.Push(pos);
        List<Node> explored = new List<Node>();

        while (!frontier.isEmpty())
        {
            Node currentNode = frontier.Pop();

            if (isGoalState(currentNode, GoalNode)) //path found, return
                return currentNode.Path();

            else //still searching..
            {
                explored.Add(currentNode);

                foreach (Node n in getSuccesors(currentNode, Grid, PathFindSuccessor))
                {
                    if (!explored.Contains(n))
                        frontier.Push(n);
                }

            }

        }

        return null; //there are no more nodes, and the goal hasn't been reached. return null
    }
开发者ID:kewur,项目名称:BattleSlash,代码行数:37,代码来源:Search.cs

示例6: BlockInfo

 public BlockInfo(Vector2i position, BlockType type, float height, Vector3 normal)
 {
     Position = position;
     Type = type;
     Height = height;
     Normal = normal;
 }
开发者ID:Silentor,项目名称:InfluenceTerrainDemo,代码行数:7,代码来源:LandMap.cs

示例7: SelectDirtBlock

	void SelectDirtBlock()
	{
		_selectedBlockType = BlockType.Dirt;
		_buttonBlockDirt.ForcePress();
		_buttonBlockGrass.ForceRelease();
		_buttonBlockStone.ForceRelease();
	}
开发者ID:Cyberbanan,项目名称:VoxelEngine,代码行数:7,代码来源:CharacterSkills.cs

示例8: convert

		//   * Convert a block to a different type of block as a copy.
		//   * 
		//   * @date 12.06.2011 23:33:50
		//   * @author Christian Scheiblich
		//   * @param blockType
		//   *          the type of block to convert to
		//   * @param block
		//   *          the pattern block keeping memory or not
		//   * @return a new block object as a copy for the the requested type
		//   * @throws BlockException
		//   *           if off sets or sizes are negative or out of bound
		public static Block convert(BlockType blockType, Block block)
		{
			Block newBlock = null;

			newBlock = create(blockType, block.getOffSetRow(), block.getOffSetCol(), block.getNoOfRows(), block.getNoOfCols());

			if(block.isMemAllocated())
			{
				newBlock.allocateMemory();

				double[][] matrix = block.get();

				for(int i = 0; i < block.getNoOfRows(); i++)
				{
					for(int j = 0; j < block.getNoOfCols(); j++)
					{
						double val = matrix[i][j];

						if(val != 0.0)
						{
							newBlock.set(i, j, val);
						}
					} // for
				} // for
			} // if

			return newBlock;
		}
开发者ID:khairy-mohamed,项目名称:FindSimilar,代码行数:39,代码来源:BlockController.cs

示例9: readBlock

        private Blox readBlock(BlockType type, string szName)
        {
            Blox blox = new Blox(szName, type);
            UseType useType;

            foreach (XmlNode node in m_xmlDocBlox.ChildNodes[1].ChildNodes) {
                if (node.Name == "indicator") {
                    blox.addIndicator(BloxReader.CreateIndicator(node));
                } else if(node.Name != "script"){
                    switch(node.Name) {
                        case "instrument_global":
                            useType = UseType.InstrumentGlobal;
                            break;
                        case "block_global":
                            useType = UseType.BlockGlobal;
                            break;
                        case "parameter":
                            useType = UseType.Parameter;
                            break;
                        default:
                            if (node.Name != "#comment") {
                                if (log.IsWarnEnabled) log.Warn("Variable Type not recognized. Skipping! (" + node.Name + ")");
                            }
                            continue;
                    }

                    blox.addVar(BloxReader.CreateVar(node, useType));
                }
            }

            return blox;
        }
开发者ID:stino14,项目名称:BloxVarReader,代码行数:32,代码来源:SystemReader.cs

示例10: GetCost

        public static uint GetCost(BlockType blockType)
        {
            switch (blockType)
            {
                case BlockType.BankRed:
                case BlockType.BankBlue:
                case BlockType.BeaconRed:
                case BlockType.BeaconBlue:
                    return 50;

                case BlockType.SolidRed:
                case BlockType.SolidBlue:
                    return 10;

                case BlockType.TransRed:
                case BlockType.TransBlue:
                    return 25;

                case BlockType.Road:
                    return 10;
                case BlockType.Jump:
                    return 25;
                case BlockType.Ladder:
                    return 25;
                case BlockType.Shock:
                    return 50;
                case BlockType.Explosive:
                    return 100;
            }

            return 1000;
        }
开发者ID:gibbed,项目名称:Infiniminer,代码行数:32,代码来源:BlockInformation.cs

示例11: create

		public static Block create(BlockType blockType, int offSetRow, int offSetCol, int noOfRows, int noOfCols)
		{
			Block block = null;

			switch(blockType)
			{
				case BlockType.Dummy :

					block = new BlockDummy(offSetRow, offSetCol, noOfRows, noOfCols);

					break;

				case BlockType.Full :

					block = new BlockFull(offSetRow, offSetCol, noOfRows, noOfCols);

					break;

				case BlockType.Index :

					block = new BlockIndex(offSetRow, offSetCol, noOfRows, noOfCols);

					break;

					default :

						throw new BlockError("BlockBuilder#create -- given BlockType is not defined");

			} // switch

			return block;

		}
开发者ID:khairy-mohamed,项目名称:FindSimilar,代码行数:33,代码来源:BlockController.cs

示例12: ChangeCurrentBlock

 private void ChangeCurrentBlock(BlockType blk)
 {
     m_enumCurrentBlock = blk;
     switch (blk)
     {
         case BlockType.Blank:
             this.空白ToolStripMenuItem.CheckState = CheckState.Checked;
             this.机器人ToolStripMenuItem.CheckState = CheckState.Unchecked;
             this.墙ToolStripMenuItem.CheckState = CheckState.Unchecked;
             this.终止点ToolStripMenuItem.CheckState = CheckState.Unchecked;
             break;
         case BlockType.Wall:
             this.空白ToolStripMenuItem.CheckState = CheckState.Unchecked;
             this.机器人ToolStripMenuItem.CheckState = CheckState.Unchecked;
             this.墙ToolStripMenuItem.CheckState = CheckState.Checked;
             this.终止点ToolStripMenuItem.CheckState = CheckState.Unchecked;
             break;
         case BlockType.Robot:
             this.空白ToolStripMenuItem.CheckState = CheckState.Unchecked;
             this.机器人ToolStripMenuItem.CheckState = CheckState.Checked;
             this.墙ToolStripMenuItem.CheckState = CheckState.Unchecked;
             this.终止点ToolStripMenuItem.CheckState = CheckState.Unchecked;
             break;
         case BlockType.Goal:
             this.空白ToolStripMenuItem.CheckState = CheckState.Unchecked;
             this.机器人ToolStripMenuItem.CheckState = CheckState.Unchecked;
             this.墙ToolStripMenuItem.CheckState = CheckState.Unchecked;
             this.终止点ToolStripMenuItem.CheckState = CheckState.Checked;
             break;
         default:
             break;
     }
 }
开发者ID:marktrue,项目名称:robotpathplan-a-star-demo,代码行数:33,代码来源:MainForm.cs

示例13: addFace

    public void addFace(FACE face, int x, int y, int z, BlockType type)
    {
        //get the template vertices needed to draw this face
        Vector3[] vertices = BlockTemplate.vertices[(int)face];

        //get the uv mapping for this block/face combination
        Vector2[] uv = BlockTypes.getUV(type, face);
        //Vector2[] uv = BlockTemplate.uv;
        //store the original vertex index
        int origin = _vertices.Count;

        for (int i=0;i<vertices.Length; i++)
        {
            Vector3 vertex = Vector3.Scale(vertices[i] + new Vector3(x,y,z), Block.SIZE);

            //translate and scale the vertex to the position of this block
            _vertices.Add(vertex);
            _uvs.Add(uv[i]);
        }

        //get a template face
        int[] triangles = BlockTemplate.face;
        for (int i=0; i<triangles.Length; i++)
        {
            //translate this index to point to the vertices we just added
            _triangles.Add(origin + triangles[i]);
        }
    }
开发者ID:silantzis,项目名称:blockotron,代码行数:28,代码来源:ChunkMeshBuffer.cs

示例14: HandleTileEdit

        public override bool HandleTileEdit(TSPlayer player, TileEditType editType, BlockType blockType, DPoint location, int objectStyle)
        {
            if (this.IsDisposed)
            return false;
              if (base.HandleTileEdit(player, editType, blockType, location, objectStyle))
            return true;

              if (editType == TileEditType.PlaceTile)
            return this.HandleTilePlace(player, blockType, location, objectStyle);
              if (editType == TileEditType.TileKill || editType == TileEditType.TileKillNoItem)
            return this.HandleTileDestruction(player, location);
              if (editType == TileEditType.PlaceWire || editType == TileEditType.PlaceWireBlue || editType == TileEditType.PlaceWireGreen)
            return this.HandleWirePlace(player, location);

              #if DEBUG || Testrun
              if (editType == TileEditType.DestroyWire) {
            player.SendMessage(location.ToString(), Color.Aqua);

            if (!TerrariaUtils.Tiles[location].active())
              return false;

            ObjectMeasureData measureData = TerrariaUtils.Tiles.MeasureObject(location);
            player.SendInfoMessage(string.Format(
              "X: {0}, Y: {1}, FrameX: {2}, FrameY: {3}, Origin X: {4}, Origin Y: {5}, Active State: {6}",
              location.X, location.Y, TerrariaUtils.Tiles[location].frameX, TerrariaUtils.Tiles[location].frameY,
              measureData.OriginTileLocation.X, measureData.OriginTileLocation.Y,
              TerrariaUtils.Tiles.ObjectHasActiveState(measureData)
            ));
              }
              #endif

              return false;
        }
开发者ID:CoderCow,项目名称:AdvancedCircuits-Plugin,代码行数:33,代码来源:UserInteractionHandler.cs

示例15: ApplyScaleAndCritical

    static string ApplyScaleAndCritical(string pattern, Stat stat, BlockType type, float effectFactor, int criticalBuffId)
    {
        float ciriticalFactor = 0;

        if (stat != null)
        {
            if (type == BlockType.Attack1 || type == BlockType.Attack2)
            {
                bool isCritical = RandomTool.IsIn(stat.Get(HeroStatType.criticalHitChance));
                if (isCritical)
                {
                    int parenOpen;
                    int parenclose;
                    SearchParenIndexs(pattern, "PhysicalAttack", out parenOpen, out parenclose);

                    pattern = pattern.Insert(parenclose, "; param=critical");
                    if (criticalBuffId > 0)
                    {
                        pattern = string.Format("Sequence({0}; Action(Contact; Buff; {1}) )", pattern, criticalBuffId);
                    }
                    ciriticalFactor = stat.Get(HeroStatType.criticalHitDamageFactor);
                }
            }
        }
        return string.Format(pattern, 1 + effectFactor + ciriticalFactor);
    }
开发者ID:pb0,项目名称:ID0_Test,代码行数:26,代码来源:BlockCommand.cs


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