Ejemplo n.º 1
0
		/** Utility method used by Linecast.
		 * Required since LevelGridNode does not inherit from GridNode.
		 * Lots of ugly casting but it was better than massive code duplication.
		 *
		 * Returns null if the node has no connection in that direction.
		 */
		protected virtual GridNodeBase GetNeighbourAlongDirection (GridNodeBase node, int direction) {
			var gridNode = node as GridNode;
			if (gridNode.GetConnectionInternal(direction)) {
				return nodes[gridNode.NodeInGridIndex+neighbourOffsets[direction]];
			}
			return null;
		}
		/** Utility method used by Linecast.
		 * Required since LevelGridNode does not inherit from GridNode.
		 * Lots of ugly casting but it was better than massive code duplication.
		 *
		 * Returns null if the node has no connection in that direction
		 */
		protected override GridNodeBase GetNeighbourAlongDirection (GridNodeBase node, int direction) {
			var levelGridNode = node as LevelGridNode;
			if (levelGridNode.GetConnection(direction)) {
				return nodes[levelGridNode.NodeInGridIndex+neighbourOffsets[direction] + width*depth*levelGridNode.GetConnectionValue(direction)];
			}
			return null;
		}