/* Recenters the HoloDeck on specified exterior and loads relevant cells. * This is called as the result of a warp door being used. */ public void LoadExterior( int x, int y, int door, bool saveFirst ) { SavePlayers(); if (saveFirst && interior) { SaveInterior(); } else if (saveFirst) { SaveExterior(); } ClearContents(); interior = false; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { int cx = x - 1 + i; int cy = y - 1 + j; Cell c = Session.session.world.GetExterior(cx, cy); HoloCell hc = AddExteriorCell(i, j); if (i == 1 && j == 1) { hc.LoadData(c, door); focalCell = hc; } else { hc.LoadData(c); } } } LoadPlayers(); interior = false; BuildWalls(); }
/* Loads any unloaded adjacent cells. */ void Expand() { List <int[]> neighbors = Adjacencies(focalCell.cell.x, focalCell.cell.y); for (int i = 0; i < neighbors.Count; i++) { int[] ne = neighbors[i]; if (!Loaded(ne[0], ne[1])) { int[] fr = FocalRelation(ne[0], ne[1]); HoloCell hc = AddExteriorCell(fr[0], fr[1]); Cell c = Session.session.world.GetExterior(ne[0], ne[1]); hc.LoadData(c); } } }
/* Loads a given interior cell. */ public void LoadInterior(Cell c, int door, bool saveFirst) { SavePlayers(); if (saveFirst && interior) { SaveInterior(); } else if (saveFirst) { SaveExterior(); } ClearContents(); cells.Add(new HoloCell(transform.position, this)); focalCell = cells[0]; focalCell.LoadData(c, door); LoadPlayers(); interior = true; }