public List <DoorLineGrid2D> GetDoorLines(DoorsGrid2D doors) { var doorLines = new List <DoorLineGrid2D>(); try { var polygon = RoomTemplateLoaderGrid2D.GetPolygonFromRoomTemplate(doors.gameObject); if (polygon == null) { return(null); } foreach (var originalLine in polygon.GetLines()) { var line = originalLine; var settings = GetSettings(line); if (line.Length - settings.Margin1 - settings.Margin2 < settings.Length - 1) { continue; } if (!settings.Enabled) { continue; } if (line.GetDirection() == OrthogonalLineGrid2D.Direction.Bottom || line.GetDirection() == OrthogonalLineGrid2D.Direction.Left) { line = line.SwitchOrientation(); } var doorLineTemp = line.Shrink(settings.Margin1, settings.Margin2); var doorLine = new DoorLineGrid2D() { From = doorLineTemp.From.ToUnityIntVector3(), To = doorLineTemp.To.ToUnityIntVector3(), Length = settings.Length, }; doorLines.Add(doorLine); } } catch (ArgumentException) { } return(doorLines); }
protected bool Equals(DoorLineGrid2D other) { return(From.Equals(other.From) && To.Equals(other.To) && Length == other.Length); }