public static bool inSameRoom(Vector2Int loc1, Vector2Int loc2) { PathRoom room1 = getRoomOf(loc1); if (room1 != null && room1 == getRoomOf(loc2)) { return(true); } return(false); }
//Returns the other room of the link public PathRoom linkedRoom(PathRoom room) { if (roomA.Equals(room)) { return(roomB); } else if (roomB.Equals(room)) { return(roomA); } return(null); }
//Checks if connected to the specified room (used when checking if we found the finish room in AStar) public bool connectedToRoom(PathRoom room) { if (room == null) { return(false); } if (room.Equals(roomA) || room.Equals(roomB)) { return(true); } return(false); }
// Start is called before the first frame update void Start() { if (roomManager == null) { roomManager = this; } rooms = new List <PathRoom>(); rooms.Add(new PathRoom("entrance", new Vector2Int(-24, -6), new Vector2Int(17, 6), new Vector2Int(18, 0), new Vector2Int(16, 0))); rooms.Add(new PathRoom("up side room 1", new Vector2Int(18, 21), new Vector2Int(27, 15), new Vector2Int(23, 14), new Vector2Int(23, 16))); rooms.Add(new PathRoom("up side room 2", new Vector2Int(30, 21), new Vector2Int(38, 15), new Vector2Int(34, 14), new Vector2Int(34, 16))); rooms.Add(new PathRoom("up side room 3", new Vector2Int(41, 21), new Vector2Int(49, 15), new Vector2Int(45, 14), new Vector2Int(45, 16))); rooms.Add(new PathRoom("up side room 4", new Vector2Int(52, 21), new Vector2Int(60, 15), new Vector2Int(56, 14), new Vector2Int(56, 16))); rooms.Add(new PathRoom("down side room 1", new Vector2Int(18, -20), new Vector2Int(27, -15), new Vector2Int(23, -14), new Vector2Int(23, -16))); rooms.Add(new PathRoom("down side room 2", new Vector2Int(30, -20), new Vector2Int(38, -15), new Vector2Int(34, -14), new Vector2Int(34, -16))); rooms.Add(new PathRoom("down side room 3", new Vector2Int(41, -20), new Vector2Int(50, -15), new Vector2Int(45, -14), new Vector2Int(45, -16))); rooms.Add(new PathRoom("down side room 4", new Vector2Int(53, -20), new Vector2Int(67, -15), new Vector2Int(57, -14), new Vector2Int(57, -16))); voiceRoom = new PathRoom("voice room", new Vector2Int(100, 3), new Vector2Int(112, -3), new Vector2Int(113, -4), new Vector2Int(113, -2)); }
public bool Equals(PathRoom room1, PathRoom room2) { PathRoomLink tempLink = new PathRoomLink(room1, room2); return(this.Equals(tempLink)); }
public PathRoomLink(PathRoom room1, PathRoom room2, int tileDistanceBetweenRooms = 0) { roomA = room1; roomB = room2; tileDistance = tileDistanceBetweenRooms; }