public void updateLines() { deleteLines(); foreach (Triggerable target in triggerComp.targets) { PostLineRenderer.Line line = new PostLineRenderer.Line(this.transform.position, target.transform.position); lineRenderer.addLine(line); } }
private void updateLines() { lineRenderer.clear(); for (int map_x = 0; map_x < map.Width; map_x++) { for (int map_y = 0; map_y < map.Height; map_y++) { Tile t = map.getTile(MapLayer.GROUND, map_x, map_y); if (t == null || t.Settings.triggerTargets.Length == 0) { continue; } foreach (int id in t.Settings.triggerTargets) { Vector2 targetTileCoordinates = map.getTilePos(id); GameObject container = getContainer(new Vector2(map_x, map_y)); GameObject targetContainer = getContainer(targetTileCoordinates); lineRenderer.addLine(new PostLineRenderer.Line(container.transform.position, targetContainer.transform.position)); } } } }