public bool PlaceLadderTile(Vector3 position) { WorldTile tile = GetTileAt(position); if (tile == null) { Debug.LogWarning("No tile found at " + position + "!"); return(false); } tile.Ladder.HasLadder = true; tile.Ladder.TilemapMember.SetTile(tile.LocalPlace, ladderTile); if (ladderCollider) { ladderCollider.ProcessTilemapChanges(); } return(true); }
public void RemoveTile(WorldTile tile) { if (tile == null) { Debug.LogWarning("TileToRemove is null!"); return; } if (tile.Biome == "Underworld") { tile.TilemapMember.SetTile(tile.LocalPlace, null); tile.Ore.TilemapMember.SetTile(tile.LocalPlace, null); TilemapCollider2D collider = tile.TilemapMember.gameObject.GetComponent <TilemapCollider2D>(); if (collider) { collider.ProcessTilemapChanges(); } //tile.WorldChunkMember.tiles.Remove(tile); } }
private void LoadNearbyChunks() { if (currentChunk == 0) // First chunk { DisplayChunkTiles(worldChunks[0]); DisplayChunkTiles(worldChunks[1]); //Previous HideChunkTiles(worldChunks[2]); } else if (currentChunk == chunksCount - 1) // Last chunk { DisplayChunkTiles(worldChunks[chunksCount - 2]); DisplayChunkTiles(worldChunks[chunksCount - 1]); //Previous HideChunkTiles(worldChunks[chunksCount - 3]); } else // Chunks inbetween first and last chunks { DisplayChunkTiles(worldChunks[currentChunk - 1]); DisplayChunkTiles(worldChunks[currentChunk]); DisplayChunkTiles(worldChunks[currentChunk + 1]); if (currentChunk > 1) { HideChunkTiles(worldChunks[currentChunk - 2]); } if (currentChunk < chunksCount - 2) { HideChunkTiles(worldChunks[currentChunk + 2]); } } if (mapCollider) { mapCollider.ProcessTilemapChanges(); } }