//todo:判断房间条件是否满足 private void checkCondition() { //基础条件 四周是封闭的(墙+门) TileItem leftUpper; TileItem rightUpper; TileItem leftBottom; TileItem rightBottom; var upperItems = new List <TileItem>(); var bottomItems = new List <TileItem>(); var rightItems = new List <TileItem>(); var leftItems = new List <TileItem>(); for (int i = 0; i < BindTileItems.Count; i++) { //四周的格子 var arroundItems = TilesManager.GetArroundTilesWithNull(BindTileItems[i].IndexX, BindTileItems[i].IndexY); //上 if (arroundItems[0] == null) { upperItems.Add(arroundItems[0]); } else if (arroundItems[0].BelongRoom == false) { upperItems.Add(arroundItems[0]); } //下 if (arroundItems[1] == null) { bottomItems.Add(arroundItems[1]); } else if (arroundItems[1].BelongRoom == false) { bottomItems.Add(arroundItems[1]); } //左 if (arroundItems[2] == null) { leftItems.Add(arroundItems[2]); } else if (arroundItems[2].BelongRoom == false) { leftItems.Add(arroundItems[2]); } //右 if (arroundItems[3] == null) { rightItems.Add(arroundItems[3]); } else if (arroundItems[3].BelongRoom == false) { rightItems.Add(arroundItems[3]); } } //去重,防止房间内有墙壁,获取上下左右四个角的格子 }