public WorldEditor() { m_rootRoom = new Room_2D(DEFAULT_WIDTH, DEFAULT_HEIGHT); m_liveRules = new RuleCollection(); m_deathRules = new RuleCollection(); m_rebornRules = new RuleCollection(); }
internal WorldMap(Room_2D room, RuleCollection deathRules, RuleCollection rebornRules, RuleCollection liveRules) { m_room = room; m_deathRules = deathRules; m_rebornRules = rebornRules; m_liveRules = liveRules; m_worldViews = new LinkedList <WorldView>(); }
/* * METHODS */ // Clean QuadTree public void Clear() { seed = -1; boundary = new AABB(); northWest = null; northEast = null; southWest = null; southEast = null; room = null; }
public void DigExits() { //Find all the eligable exits LinkedList <Room_2D> eligableRooms = new LinkedList <Room_2D> (); foreach (Room_2D room in rooms) { int col = Mathf.RoundToInt(room.boundary.center.x); int row = Mathf.RoundToInt(room.boundary.center.y); if (Mathf.Abs(MAP_ROWS - row) <= ROOM_TO_EXIT_LENGTH || row <= ROOM_TO_EXIT_LENGTH || Mathf.Abs(MAP_COLS - col) <= ROOM_TO_EXIT_LENGTH || col <= ROOM_TO_EXIT_LENGTH) { eligableRooms.AddLast(room); } } //Choose a random number of exits/entrances int roomCount = eligableRooms.Count; if (roomCount > 0) { int index = Random.Range(0, roomCount); Room_2D room = eligableRooms.ElementAt(index); int col = Mathf.RoundToInt(room.boundary.center.x); int row = Mathf.RoundToInt(room.boundary.center.y); if (Mathf.Abs(MAP_ROWS - row) <= ROOM_TO_EXIT_LENGTH || row <= ROOM_TO_EXIT_LENGTH) { if (row > MAP_ROWS / 2) { DigExit(row, col, MAP_ROWS - 1, col); } else { DigExit(row, col, 0, col); } } else if (Mathf.Abs(MAP_COLS - col) <= ROOM_TO_EXIT_LENGTH || col <= ROOM_TO_EXIT_LENGTH) { if (col > MAP_COLS / 2) { DigExit(row, col, row, MAP_COLS - 1); } else { DigExit(row, col, row, 0); } } } }
public void Reset() { m_rootRoom = new Room_2D(m_rootRoom.Width, m_rootRoom.Height); }
public void Resize(int width, int height) { m_rootRoom = new Room_2D(width, height); }