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


C# Block.GetBlockType方法代码示例

本文整理汇总了C#中Block.GetBlockType方法的典型用法代码示例。如果您正苦于以下问题:C# Block.GetBlockType方法的具体用法?C# Block.GetBlockType怎么用?C# Block.GetBlockType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Block的用法示例。


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

示例1: endLayFloor

    private void endLayFloor(Block destinationArea, Block preArea ,Direction preDirection)
    {
        Debug.Log("通路の最後の処理だよ");
        GameObject aisleFloor = (GameObject)Resources.Load("Prehabs/Floor1");
        AisleWidth = Random.Range(1, 1);

        int endAislePositionX = 0;
        int endAislePositionY = 0;
        int endReturnPoint = 0;

        // 通路の方向の修正
        switch (preDirection)
        {
            case Block.Direction.Up:
                preDirection = Block.Direction.Down;
                break;
            case Block.Direction.Right:
                preDirection = Block.Direction.Left;
                break;
            case Block.Direction.Down:
                preDirection = Block.Direction.Up;
                break;
            case Block.Direction.Left:
                preDirection = Block.Direction.Right;
                break;
        }

        Debug.Log("最後の方向は:" + preDirection);
        if(destinationArea.GetBlockType() == Block.BlockType.Room)
        {
            getRoadPositionsFromRoom(destinationArea, preDirection, ref endAislePositionX, ref endAislePositionY);
        }
        else
        {
            getRoadPositionsFromAisle(destinationArea, preDirection, ref endAislePositionX, ref endAislePositionY);
        }

        int tmpAislePositionY = endAislePositionY;
        int tmpAislePositionX = endAislePositionX;
        Debug.Log("部屋の位置 x:" + destinationArea.RoompositionX + "y;" + destinationArea.RoompositionY + "部屋の大きさ 縦:" + destinationArea.RoomHeight + "横:" + destinationArea.RoomWidth);
        Debug.Log("ここからかくんご x:" + endAislePositionX + " y:" + endAislePositionY);

        switch (preDirection)
        {
            case Block.Direction.Up:
                while (endAislePositionY < BlockHeight)
                {
                    while (endAislePositionX < tmpAislePositionX + AisleWidth)
                    {
                        generateTile(aisleFloor, destinationArea, endAislePositionX, endAislePositionY);
                        endAislePositionX++;
                    }
                    endAislePositionX = tmpAislePositionX;
                    endAislePositionY++;
                    endReturnPoint = 0;
                }
                break;
            case Block.Direction.Down:
                while (endAislePositionY >= 0)
                {
                    while (endAislePositionX < tmpAislePositionX + AisleWidth)
                    {
                        generateTile(aisleFloor, destinationArea, endAislePositionX, endAislePositionY);
                        endAislePositionX++;
                    }
                    endAislePositionX = tmpAislePositionX;
                    endAislePositionY--;
                    endReturnPoint = BlockHeight - 1;
                }
                break;
            case Block.Direction.Right:
                while (endAislePositionX < BlockWidth)
                {
                    while (endAislePositionY < tmpAislePositionY + AisleWidth)
                    {
                        generateTile(aisleFloor, destinationArea, endAislePositionX, endAislePositionY);
                        endAislePositionY++;
                    }
                    endAislePositionY = tmpAislePositionY;
                    endAislePositionX++;
                    endReturnPoint = 0;
                }
                break;

            case Block.Direction.Left:
                while (endAislePositionX >= 0)
                {
                    while (endAislePositionY < tmpAislePositionY + AisleWidth)
                    {
                        generateTile(aisleFloor, destinationArea, endAislePositionX, endAislePositionY);
                        endAislePositionY++;
                    }
                    endAislePositionY = tmpAislePositionY;
                    endAislePositionX--;
                    endReturnPoint = BlockWidth - 1;
                }
                break;
        }

        if (preDirection == Block.Direction.Up
//.........这里部分代码省略.........
开发者ID:yoshikimaehara,项目名称:Unity-test,代码行数:101,代码来源:Block.cs

示例2: TryAttachWithBlock

        public bool TryAttachWithBlock(Block block)
        {
            foreach (Connection connection in block.connections) {
                if (this.connectionType != connection.connectionType
                    &&
                    connection.connectedBlock == null
                    &&
                    this.connectedBlock == null
                    &&
                    (this.acceptableBlockType & block.GetBlockType ()) != BlockType.BlockTypeNone
                    &&
                    this.DistanceTo (connection) < kMinimumAttachRadius) {

                    if (this.ownerBlock.connections.IndexOf(this) == 0) {
                        Vector2 delta =  connection.AbsolutePosition() - this.AbsolutePosition();

                        this.ownerBlock.ApplyDelta(delta);
                    }
                    else {
                        Vector2 delta =  this.AbsolutePosition() - connection.AbsolutePosition();

                        block.ApplyDelta(delta);
                    }

                    this.connectedBlock = block;
                    connection.connectedBlock = this.ownerBlock;

                    return true;
                }
            }

            return false;
        }
开发者ID:ssouzawallace,项目名称:blocks-programming,代码行数:33,代码来源:Block.cs

示例3: isPlaceRoom

 /// <summary>
 /// 対象エリアに部屋を設置できる場合はtrueを返す、それ以外はfalseを返す。
 /// </summary>
 /// <param name="room"></param>
 /// <returns></returns>
 private bool isPlaceRoom(Block area)
 {
     // 既に部屋の生成がされている場合
     if (area.GetBlockType() == Block.BlockType.Room)
     {
         return false;
     }
     // 部屋数の最大値を満たしている場合
     if (roomValue > MAXROOMVALUE)
     {
         return false;
     }
     // 乱数生成
     if (Random.value > roomProbability)
     {
         return false;
     }
     return true;
 }
开发者ID:yoshikimaehara,项目名称:Unity-test,代码行数:24,代码来源:Map.cs


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