Exemplo n.º 1
0
		//END IFunnelGraph Implementation
		
		
		public bool CheckConnection (GridNode node, int dir) {
			if (neighbours == NumNeighbours.Eight) {
				return node.GetConnection (dir);
			} else {
				int dir1 = (dir-4-1) & 0x3;
				int dir2 = (dir-4+1) & 0x3;
				
				if (!node.GetConnection (dir1) || !node.GetConnection (dir2)) {
					return false;
				} else {
					GridNode n1 = nodes[node.GetIndex ()+neighbourOffsets[dir1]] as GridNode;
					GridNode n2 = nodes[node.GetIndex ()+neighbourOffsets[dir2]] as GridNode;
					
					if (!n1.walkable || !n2.walkable) {
						return false;
					}
					
					if (!n2.GetConnection (dir1) || !n1.GetConnection (dir2)) {
						return false;
					}
				}
				return true;
			}
		}