當前位置: 首頁>>代碼示例>>C#>>正文


C# MultiComponentList.RemoveXYZH方法代碼示例

本文整理匯總了C#中Server.MultiComponentList.RemoveXYZH方法的典型用法代碼示例。如果您正苦於以下問題:C# MultiComponentList.RemoveXYZH方法的具體用法?C# MultiComponentList.RemoveXYZH怎麽用?C# MultiComponentList.RemoveXYZH使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.MultiComponentList的用法示例。


在下文中一共展示了MultiComponentList.RemoveXYZH方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DeleteStairs

        public static bool DeleteStairs( MultiComponentList mcl, int id, int x, int y, int z )
        {
            int ax = x + mcl.Center.X;
            int ay = y + mcl.Center.Y;

            if ( ax < 0 || ay < 0 || ax >= mcl.Width || ay >= (mcl.Height - 1) || z < 7 || ((z - 7) % 5) != 0 )
                return false;

            if ( IsStairBlock( id ) )
            {
                Tile[] tiles = mcl.Tiles[ax][ay];

                for ( int i = 0; i < tiles.Length; ++i )
                {
                    Tile tile = tiles[i];

                    if ( tile.Z == (z + 5) )
                    {
                        id = tile.ID;
                        z = tile.Z;

                        if ( !IsStairBlock( id ) )
                            break;
                    }
                }
            }

            int dir = 0;

            if ( !IsStair( id, ref dir ) )
                return false;

            int height = ((z - 7) % 20) / 5;

            int xStart, yStart;
            int xInc, yInc;

            switch ( dir )
            {
                default:
                case 0: // North
                {
                    xStart = x;
                    yStart = y + height;
                    xInc = 0;
                    yInc = -1;
                    break;
                }
                case 1: // West
                {
                    xStart = x + height;
                    yStart = y;
                    xInc = -1;
                    yInc = 0;
                    break;
                }
                case 2: // South
                {
                    xStart = x;
                    yStart = y - height;
                    xInc = 0;
                    yInc = 1;
                    break;
                }
                case 3: // East
                {
                    xStart = x - height;
                    yStart = y;
                    xInc = 1;
                    yInc = 0;
                    break;
                }
            }

            int zStart = z - (height * 5);

            for ( int i = 0; i < 4; ++i )
            {
                x = xStart + (i * xInc);
                y = yStart + (i * yInc);

                for ( int j = 0; j <= i; ++j )
                    mcl.RemoveXYZH( x, y, zStart + (j * 5), 5 );

                ax = x + mcl.Center.X;
                ay = y + mcl.Center.Y;

                if ( ax >= 1 && ax < mcl.Width && ay >= 1 && ay < mcl.Height - 1 )
                {
                    Tile[] tiles = mcl.Tiles[ax][ay];

                    bool hasBaseFloor = false;

                    for ( int j = 0; !hasBaseFloor && j < tiles.Length; ++j )
                        hasBaseFloor = ( tiles[j].Z == 7 && (tiles[j].ID & 0x3FFF) != 1 );

                    if ( !hasBaseFloor )
                        mcl.Add( 0x31F4, x, y, 7 );
                }
            }
//.........這裏部分代碼省略.........
開發者ID:BackupTheBerlios,項目名稱:sunuo-svn,代碼行數:101,代碼來源:HouseFoundation.cs


注:本文中的Server.MultiComponentList.RemoveXYZH方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。