/// <summary> ///Add a chunk to the chunkset /// </summary> /// <param name="chunk"> ///The chunk you wish to add /// </param> /// <param name="depth"> ///The depth at which you are adding the chunk /// </param> public void AddChunkAt(MapChunk chunk, int depth) { if (chunkSet == null || chunkSet.Length == 0) { chunkSet = new MapChunkEntry[1]; chunkSet[0] = new ChunkSet.MapChunkEntry(chunk, depth); return; } if (ContainsDepth(depth)) { Debug.LogWarning("Attemping to add a chunk at depth: " + depth + " to set at " + x + "," + y); return; } int newLength = chunkSet.Length + 1; MapChunkEntry[] newSet = new MapChunkEntry[newLength]; for (int i = 0; i < chunkSet.Length; i++) { newSet[i] = chunkSet[i]; } newSet[newLength - 1] = new ChunkSet.MapChunkEntry(chunk, depth); chunkSet = newSet; }
/// <summary> ///Add a chunk to the chunkset /// </summary> /// <param name="chunk"> ///The chunk you wish to add /// </param> /// <param name="depth"> ///The depth at which you are adding the chunk /// </param> public void AddChunkAt(MapChunk chunk, int depth) { if(chunkSet == null || chunkSet.Length == 0){ chunkSet = new MapChunkEntry[1]; chunkSet[0] = new ChunkSet.MapChunkEntry(chunk,depth); return; } if(ContainsDepth(depth)){ Debug.LogWarning("Attemping to add a chunk at depth: " + depth + " to set at " + x + "," + y); return; } int newLength = chunkSet.Length + 1; MapChunkEntry[] newSet = new MapChunkEntry[newLength]; for(int i = 0; i < chunkSet.Length; i++){ newSet[i] = chunkSet[i]; } newSet[newLength-1] = new ChunkSet.MapChunkEntry(chunk,depth); chunkSet = newSet; }