/// <summary> /// Returns the block which lies next to this block in given direction. /// If such block doesn't exist null is returned. /// Uses parent map to determine next block and if the parent map is null, null is returned. /// </summary> /// <param name="direction">Direction of next block.</param> /// <returns>Adjacent block or null.</returns> public MapBlock NextBlock(Direction direction) { if (ParentMap == null) { return(null); } return(ParentMap.AdjacentBlock(x, y, direction)); }