public GraphicalLink getGraphicalLink(Link link) { GameObject general = Instantiate(prefabLinkLine) as GameObject; GraphicalLink specific = general.GetComponent <GraphicalLink>(); specific.setTo(link); return(specific); }
public static void checkLoaded() { int twiceDraw = drawDist * 2; int iX = (int)x; int iY = (int)y; foreach (GraphicalHex hex in loaded) { hex.needed = false; } for (int i = 0; i < twiceDraw; i++) { for (int j = 0; j < twiceDraw; j++) { int mX = iX + i - drawDist; int mY = iY + j - drawDist; if (map.canGet(mX, mY)) { if (map.grid[mX][mY].outer == null) { map.grid[mX][mY].outer = world.prefabStore.getGraphicalHex(map.grid[mX][mY]); map.grid[mX][mY].outer.transform.position = getLoc(map.grid[mX][mY].outer); loaded.AddLast(map.grid[mX][mY].outer); if (map.grid[mX][mY].location != null) { foreach (Link link in map.grid[mX][mY].location.links) { if ( link.other(map.grid[mX][mY].location).index > link.other(link.other(map.grid[mX][mY].location)).index) { continue; } GraphicalLink grLink = world.prefabStore.getGraphicalLink(link); grLink.transform.parent = map.grid[mX][mY].outer.transform; } } } map.grid[mX][mY].outer.needed = true; } } } List <GraphicalHex> unNeeded = new List <GraphicalHex>(); foreach (GraphicalHex hex in loaded) { if (hex.needed == false) { unNeeded.Add(hex); hex.hex.outer = null; unNeeded.Add(hex); } } foreach (GraphicalHex hex in unNeeded) { loaded.Remove(hex); } }