/// <summary> /// 是否可通行判断 /// </summary> /// <param name="edge_x"></param> /// <param name="edge_y"></param> /// <param name="destroy_wall">墙默认是不可通行的,如果可摧毁则认为墙可通行。 </param> /// <param name="whiteList">白名单列表,该列表中的对象不阻挡通行。</param> /// <returns></returns> public bool IsPassable(int edge_x, int edge_y, bool destroy_wall = false, Dictionary <TileEntity, bool> whiteList = null) { int entity_id = m_routeMap[edge_x, edge_y].EntityID; if (entity_id != 0) { // 连接器的情况下(是否通行根据墙标记确定) if (entity_id == m_wallLinkerId) { return(destroy_wall); } TileEntity entity = m_entityHash[entity_id]; Assert.Should(entity != null); // 白名单中的对象可通行 if (whiteList != null && whiteList.ContainsKey(entity)) { return(true); } if (destroy_wall) { if (entity.entityType != EntityType.Wall && EntityTypeUtil.IsAnyBlockage(entity.entityType)) { return(false); } } else { if (EntityTypeUtil.IsAnyBlockage(entity.entityType)) { return(false); } } } return(true); }