Exemplo n.º 1
0
    /// <summary>
    /// 删除一个楼梯区间的楼梯
    /// </summary>
    private static void DeleteStairAreaStair(int Layer, int Start, int End)
    {
        bool     haveStair           = false;
        int      distance            = 0;
        RoomGrid deleteStairRoomGrid = null;

        for (int unit = Start; unit <= End; unit++)
        {
            RoomGrid R = FindRoomGrid(new Int2(unit, Layer), XYSYS.RoomGrid);
            if (R != null && R.HaveStair())
            {
                if (haveStair == false)
                {
                    distance            = DistanceGold(R);
                    haveStair           = true;
                    deleteStairRoomGrid = R;
                }
                else if (deleteStairRoomGrid != null)
                {
                    int d = DistanceGold(R);
                    //删除距离近的楼梯
                    if (d <= distance)
                    {
                        R.RemovStair();
                    }
                    else
                    {
                        deleteStairRoomGrid.RemovStair();
                        deleteStairRoomGrid = R;
                        distance            = d;
                    }
                }
            }
        }
    }