public bool SetPosition(DoorStruct adjacentDoor, Room adjacentRoom, ProceduralMapManager mapManager) { //set references this.adjacentDoor = adjacentDoor; this.adjacentRoom = adjacentRoom; if (adjacentRoom == null || adjacentDoor.doorTransform == null) { Debug.Log("<color=red>Houston, abbiamo un problema</color>"); } //check this room has a door to adjacent room, and adjust position if (CheckDoors() == false) { return(false); } //check this room is not inside another room and viceversa if (CheckOverlap(mapManager) == false) { return(false); } return(true); }
bool CheckOverlap(ProceduralMapManager mapManager) { //check rooms of this map manager and also rooms of others map managers List <Room> roomsToCheck = new List <Room>(mapManager.Rooms); if (mapManager.RoomsEveryOtherMapManager != null) { roomsToCheck.AddRange(mapManager.RoomsEveryOtherMapManager); } //foreach room foreach (Room room in roomsToCheck) { //check if there is a room inside this one if (PointsInsideRoom(room)) { return(false); } //check if this one is inside a room if (room.PointsInsideRoom(this)) { return(false); } } return(true); }
public override bool IsValid(Room roomToPlace, ProceduralMapManager mapManager) { //for every axis, check switch (axis) { case Axis.X: return(CheckToDo(roomToPlace.transform.position.x)); case Axis.Y: return(CheckToDo(roomToPlace.transform.position.y)); case Axis.Z: return(CheckToDo(roomToPlace.transform.position.z)); default: return(false); } }
public abstract bool IsValid(Room roomToPlace, ProceduralMapManager mapManager);
private void OnEnable() { mapManager = target as ProceduralMapManager; }