Added spacing between parallel spots

This commit is contained in:
Dawid Pietrykowski 2022-09-10 20:40:50 +02:00
parent 788db702cd
commit 756cf37d8f
3 changed files with 10 additions and 36 deletions

View File

@ -117,7 +117,7 @@ namespace Parking
break; break;
} }
else if(carFitsParallel && freeParallelSpotsAvailable){ else if(carFitsParallel && freeParallelSpotsAvailable){
parallelLengthAvailable[laneId] -= spotSizes[(int) driver.Size]; parallelLengthAvailable[laneId] -= spotSizes[(int) driver.Size] + 0.5f;
spotCountsPerpendicular[laneId] = 0; spotCountsPerpendicular[laneId] = 0;
spotsCreatedTemp[laneId, (int) driver.Size + 4]++; spotsCreatedTemp[laneId, (int) driver.Size + 4]++;
break; break;

View File

@ -361,7 +361,7 @@ namespace Parking
if (spot.Size > newSize) { if (spot.Size > newSize) {
if (!spot.Perpendicular) { if (!spot.Perpendicular) {
float newX = GetNextBorderHorizontal(position, spot.Lane, spot.Perpendicular, newSize, true) - float newX = GetNextBorderHorizontal(position, spot.Lane, spot.Perpendicular, newSize, true) -
_spotHeights[(int) spot.Size] / 2.0f; _spotHeights[(int) spot.Size] / 2.0f - 0.5f;
newPosition = new Vector3(newX, newPosition = new Vector3(newX,
newPosition.y, newPosition.z); newPosition.y, newPosition.z);
} }
@ -398,7 +398,7 @@ namespace Parking
float nextBorder = GetNextBorderVectical(newPosition, spot.Lane, spot.Perpendicular, newSize, float nextBorder = GetNextBorderVectical(newPosition, spot.Lane, spot.Perpendicular, newSize,
!spot.AlignToTop); !spot.AlignToTop);
if (Math.Abs(spotBorder - nextBorder) < 5.5f) if (Math.Abs(spotBorder - nextBorder) < 5.5f)
continue; // Try parallel (?) continue;
} }
else { else {
float nextBorderLeft = GetNextBorderHorizontal(newPosition, spot.Lane, spot.Perpendicular, newSize, float nextBorderLeft = GetNextBorderHorizontal(newPosition, spot.Lane, spot.Perpendicular, newSize,
@ -615,12 +615,12 @@ namespace Parking
currentX += (i != 0 ? 1 : -1) * currentX += (i != 0 ? 1 : -1) *
(spotMap[i][j].Perpendicular (spotMap[i][j].Perpendicular
? 2.25f / 2.0f ? 2.25f / 2.0f
: spotSizes[(int) spotMap[i][j].Size] / 2.0f); : spotSizes[(int) spotMap[i][j].Size] / 2.0f + (j != 0 ? 0.25f : 0));
else else
currentX += (i != 0 ? 1 : -1) * currentX += (i != 0 ? 1 : -1) *
(spotMap[i][j].Perpendicular (spotMap[i][j].Perpendicular
? 2.5f / 2.0f ? 2.5f / 2.0f
: spotSizes[(int) spotMap[i][j].Size] / 2.0f); : spotSizes[(int) spotMap[i][j].Size] / 2.0f + (j != 0 ? 0.25f : 0));
spotMap[i][j].Flipped = flipped; spotMap[i][j].Flipped = flipped;
@ -662,12 +662,12 @@ namespace Parking
currentX += (i != 0 ? 1 : -1) * currentX += (i != 0 ? 1 : -1) *
(spotMap[i][j].Perpendicular (spotMap[i][j].Perpendicular
? 2.25f / 2.0f ? 2.25f / 2.0f
: spotSizes[(int) spotMap[i][j].Size] / 2.0f); : spotSizes[(int) spotMap[i][j].Size] / 2.0f + (j != 0 ? 0.25f : 0));
else else
currentX += (i != 0 ? 1 : -1) * currentX += (i != 0 ? 1 : -1) *
(spotMap[i][j].Perpendicular (spotMap[i][j].Perpendicular
? 2.5f / 2.0f ? 2.5f / 2.0f
: spotSizes[(int) spotMap[i][j].Size] / 2.0f); : spotSizes[(int) spotMap[i][j].Size] / 2.0f + (j != 0 ? 0.25f : 0));
flipped = !flipped; flipped = !flipped;
} }

File diff suppressed because one or more lines are too long