Added free space filling
This commit is contained in:
parent
d5983e8d6c
commit
66558149ca
@ -29,7 +29,7 @@ namespace Parking
|
||||
}
|
||||
|
||||
var countsString = $"Małe: {counts[0]} Średnie: {counts[1]} Duże: {counts[2]} " +
|
||||
$"Suma: {counts.Sum()}";
|
||||
$"Suma: {counts.Sum() + 1}";
|
||||
ParkingManager.Instance.UpdateText(countsString);
|
||||
Debug.Log(countsString);
|
||||
|
||||
@ -104,33 +104,39 @@ namespace Parking
|
||||
}
|
||||
}
|
||||
|
||||
// for (var laneId = 3; laneId >= 0; laneId--) {
|
||||
// if (spotCountsPerpendicular[laneId] != 0) {
|
||||
// if (sizeIds[laneId] == 0) {
|
||||
// // empty
|
||||
// }
|
||||
// else if (sizeIds[laneId] == 1) {
|
||||
// // parallel only
|
||||
// }
|
||||
// else {
|
||||
// spotsCreatedTemp[laneId, sizeIds[laneId] - 2] += spotCountsPerpendicular[laneId];
|
||||
// spotCountsPerpendicular[laneId] = 0;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
int count = 0;
|
||||
|
||||
for (var i = 0; i < spotsCreatedTemp.GetLength(0); i++)
|
||||
for (var j = 0; j < spotsCreatedTemp.GetLength(1); j++)
|
||||
count += spotsCreatedTemp[i, j];
|
||||
|
||||
if(copyToArray)
|
||||
for (var i = 0; i < spotsCreatedTemp.GetLength(0); i++)
|
||||
for (var j = 0; j < spotsCreatedTemp.GetLength(1); j++)
|
||||
spotsCreated[i, j] = spotsCreatedTemp[i, j];
|
||||
count += spotsCreatedTemp[i, j];
|
||||
|
||||
|
||||
if (!copyToArray)
|
||||
return count;
|
||||
|
||||
for (var laneId = 3; laneId >= 0; laneId--) {
|
||||
if (spotCountsPerpendicular[laneId] != 0) {
|
||||
if (sizeIds[laneId] == 0) {
|
||||
// empty
|
||||
}
|
||||
else if (sizeIds[laneId] == 1) {
|
||||
// parallel only
|
||||
}
|
||||
else {
|
||||
spotsCreatedTemp[laneId, sizeIds[laneId] - 2] += spotCountsPerpendicular[laneId];
|
||||
count += spotCountsPerpendicular[laneId];
|
||||
spotCountsPerpendicular[laneId] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (var i = 0; i < spotsCreatedTemp.GetLength(0); i++)
|
||||
for (var j = 0; j < spotsCreatedTemp.GetLength(1); j++)
|
||||
spotsCreated[i, j] = spotsCreatedTemp[i, j];
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user