Example #1
0
    /// <summary>
    /// 获取未连接的放置房间
    /// </summary>
    public static List <CanvasCore> GetNoLinkPutRoom(/*CanvasCore Core,  Int2 TargetPos*/)
    {
        List <CanvasCore> lNolinkCore = new List <CanvasCore>();

        /*
         * if (Core.m_type != ShipBuildType.BuildRoom)
         *      return lNolinkCore;
         * if (Core.IsDeckRoom == true)
         * {
         *  lNolinkCore.Add(Core);
         *  return lNolinkCore;
         * }*/
        //
        List <Int2> lOld = new List <Int2>(); //Core.GetPutRoomGridXY();
        List <Int2> lNew = new List <Int2>(); //Core.GetMovetoRoomGridXY(TargetPos);
        //获取未连接的节点
        List <RoomGrid> lNolink = RoomMap.GetNoLinkRoom(lOld, lNew);

        List <int> lBuild = new List <int>();

        foreach (RoomGrid R in lNolink)
        {
            if (R != null)
            {
                if (lBuild.Contains(R.buildingid) == false)
                {
                    lBuild.Add(R.buildingid);
                }
            }
        }
        //
        foreach (int buildingid in lBuild)
        {
            if (buildingid != RoomGrid.EMPTYGRIDID)
            {
                lNolinkCore.Add(new CanvasCore(ShipBuildType.BuildRoom, false, buildingid, buildingid, Vector2.zero));
            }
            //else lNolinkCore.Add(Core);
        }
        return(lNolinkCore);
    }