Time-based placement improvements WIP
This commit is contained in:
parent
2574f9701d
commit
932c7f9c17
141
Assets/Data/Tablica1.csv
Normal file
141
Assets/Data/Tablica1.csv
Normal file
@ -0,0 +1,141 @@
|
||||
Ranga stanowiska ;wybrany sposób parkowania;Klasyfikacja gabarytu ;od planwane;do planowane;od rzeczywiste;do rzeczywiste;czas miedzy sprawdzaniem miejsca
|
||||
1;P;Duży;9;15;8:45;13:20;60
|
||||
1;T;Duży;8;10;7:53;10:01;60
|
||||
1;;Duży;9;13;8:53;14:02;60
|
||||
1;P;Duży;8;16;7:45;16:10;60
|
||||
1;;Duży;9;16;9:30;14;60
|
||||
1;P;Duży;11;14;12;14:10;60
|
||||
1;P;Duży;10;15;9:50;13:10;60
|
||||
1;P;Duży;9;15;9:20;14:50;60
|
||||
1;;Duży;9;17;9;17:04;60
|
||||
1;;Duży;12;17;12:50;17:02;60
|
||||
1;;Duży;9;17;9;16:58;60
|
||||
1;P;Duży;10;15;9:50;13:30;60
|
||||
1;;Duży;9;14;9:30;14:10;60
|
||||
1;;Duży;8;16;7:56;17:12;60
|
||||
1;;Duży;9;15;10;12:30;60
|
||||
2;;Duży;8;16;7:50;17:05;15
|
||||
2;P;Mały;7;15;6:40;14:50;15
|
||||
2;;Średni;7;15;7:05;15:14;15
|
||||
2;;Duży;10;16;10:49;15:58;15
|
||||
2;P;Średni;8;16;8:49;15:04;15
|
||||
2;;Średni;9;17;9:23;16:59;15
|
||||
2;P;Duży;8;16;7:49;16:05;15
|
||||
2;T;Średni;7:30;15:30;7:27;15:36;15
|
||||
2;T;Duży;8;16;8:10;15:50;15
|
||||
2;P;Duży;7:30;15:30;7:53;15:37;15
|
||||
2;;Duży;8;16;7:53;16:01;15
|
||||
2;T;Średni;7:30;15:30;7:35;15:30;15
|
||||
2;;Duży;8;16;7:53;16:40;15
|
||||
2;P;Średni;8;16;7:57;16:01;15
|
||||
2;;Średni;8;16;7:45;16:10;15
|
||||
2;T;Duży;11;16;11:18;16:13;15
|
||||
2;;Duży;10;16;10:05;16:08;15
|
||||
2;;Duży;7;15;7;15:10;15
|
||||
3;P;Mały;6;14;6:05;13:55;15
|
||||
3;;Mały;8;16;7:45;16:10;15
|
||||
3;P;Średni;8;16;7:50;16:15;15
|
||||
3;;Duży;8;16;8:03;16:10;15
|
||||
3;;Średni;8;10;8;9:58;15
|
||||
3;;Średni;7:30;12:30;7:25;12:32;15
|
||||
3;T;Duży;8;12;8:02;12:05;15
|
||||
3;;Średni;7:30;13:30;7:28;13:40;15
|
||||
3;T;Średni;7:30;15:30;7:15;15:17;15
|
||||
3;;Mały;8;16;7:45;16:10;15
|
||||
3;P;Średni;7;7;6:58;7:10;15
|
||||
3;P;Duży;8;16;7:57;15:58;15
|
||||
3;;Średni;6;14;6:05;14:10;15
|
||||
3;;Średni;6;14;6:01;14:03;15
|
||||
3;;Mały;6:30;14:30;6:32;14:34;15
|
||||
3;P;Średni;7;15;6:57;15;15
|
||||
3;P;Duży;8;16;7:45;16:10;15
|
||||
3;;Średni;8;16;8:02;15:59;15
|
||||
3;;Średni;8:30;16:30;8:21;16:27;15
|
||||
3;P;Mały;9;17;9:02;17:10;15
|
||||
3;;Średni;9;17;8:57;16:58;15
|
||||
3;;Średni;8;16;8:04;16:12;15
|
||||
3;;Mały;8;16;7:52;15:57;15
|
||||
3;T;Średni;7;15;7:08;15:14;15
|
||||
3;;Średni;7:30;15:30;7:31;15:39;15
|
||||
3;;Duży;8;16;7:56;15:57;15
|
||||
3;;Mały;8;16;7:50;15:59;15
|
||||
3;P;Średni;8:30;16:30;8:27;16:34;15
|
||||
3;;Mały;7;15;6:57;15:05;15
|
||||
3;;Średni;8;16;8:02;15:59;15
|
||||
3;T;Średni;7;15;6:54;15:01;15
|
||||
3;;Mały;8;16;7:49;15:58;15
|
||||
3;;Średni;8;16;8;15:58;15
|
||||
3;;Duży;8:30;16:30;8:25;16:32;15
|
||||
3;T;Średni;8;16;8:04;16:10;15
|
||||
3;;Średni;7;15;6:58;15:03;15
|
||||
3;;Średni;7:30;15:30;7:29;15:40;15
|
||||
3;;Mały;7:30;3:30;7:28;12:33;15
|
||||
3;P;Średni;7;15;7:57;14:59;15
|
||||
3;P;Mały;7;13;0:00;0:00;15
|
||||
3;;Duży;8;16;8:04;15:59;15
|
||||
3;;Średni;7:30;15:30;7:25;15:35;15
|
||||
3;P;Mały;8;16;8:02;15:58;15
|
||||
3;;Duży;7:30;15:30;7:28;15:34;15
|
||||
3;;Średni;8;16;7:53;16:01;15
|
||||
3;;Średni;7;12;6:58;12:05;15
|
||||
3;;Mały;8;13;7:56;13:59;15
|
||||
3;;Mały;7:30;12;7:24;12:28;15
|
||||
3;;Średni;8;14;8:01;14:07;15
|
||||
3;T;Duży;8;13;8:10;13:12;15
|
||||
3;;Średni;7:30;15:30;7:22;15:20;15
|
||||
3;P;Średni;8;16;7:49;15:58;15
|
||||
3;;Mały;8;16;7:45;16:10;15
|
||||
3;;Średni;7:30;15:30;7:31;15:35;15
|
||||
3;;Duży;7;15;6:57;15:01;15
|
||||
3;T;Średni;7;15;7:08;1:15;15
|
||||
3;;Mały;7:30;15:30;7:25;15:28;15
|
||||
3;;Duży;8;16;7:53;16:01;15
|
||||
3;P;Średni;8;16;7:56;15:58;15
|
||||
3;;Średni;7;15;6:56;15:03;15
|
||||
3;T;Mały;7;15;7;15:05;15
|
||||
3;;Średni;8;16;7:56;16:58;15
|
||||
3;P;Średni;7;15;6:57;14:59;15
|
||||
3;;Średni;7;15;6:55;14:58;15
|
||||
3;;Duży;8;16;8:02;16:07;15
|
||||
3;T;Średni;8;16;7:56;16:05;15
|
||||
3;;Średni;7;15;6:58;15:03;15
|
||||
3;;Duży;8;16;8;16:05;15
|
||||
3;;Mały;8;16;8:04;15:58;15
|
||||
3;;Średni;7:30;15:30;7:34;15:40;15
|
||||
3;P;Średni;8;16;7:53;16:01;15
|
||||
3;;Średni;8;13;7:49;13:02;15
|
||||
3;;Średni;7;15;6:58;15:04;15
|
||||
3;;Średni;7;15;7:08;15:05;15
|
||||
3;P;Średni;8;16;7:58;16:05;15
|
||||
3;;Średni;7;15;7:04;15:11;15
|
||||
3;P;Średni;6:30;14:30;6:25;14:29;15
|
||||
3;P;Średni;9;17;8:49;17:05;15
|
||||
3;;Średni;9;17;8:55;17:01;15
|
||||
3;P;Duży;7;15;6:58;15:10;15
|
||||
3;;Duży;7:30;15:30;7:25;15:31;15
|
||||
3;;Średni;7:30;11:30;7:27;11:32;15
|
||||
3;T;Średni;8;16;7:56;16;15
|
||||
3;;Średni;8;16;8:02;16:05;15
|
||||
3;;Średni;7:30;15:30;7:36;15:40;15
|
||||
3;;Średni;8;16;8:04;16:07;15
|
||||
3;P;Średni;8;9;7:59;9:09;15
|
||||
3;;Średni;7:15;15:15;7:10;15:18;15
|
||||
3;T;Duży;8;16;7:49;15:51;15
|
||||
3;;Średni;8;16;8:04;16:11;15
|
||||
3;P;Średni;8;16;8:02;16:03;15
|
||||
3;;Średni;7;15;7:01;15:07;15
|
||||
3;;Duży;7:30;15:30;7:25;15:25;15
|
||||
3;P;Średni;7;15;7:08;15:15;15
|
||||
3;;Średni;8;16;7:45;16:10;15
|
||||
3;;Średni;8;16;7:49;15:59;15
|
||||
3;;Średni;8;16;7:45;16:10;15
|
||||
3;T;Duży;7;15;7:07;15:20;15
|
||||
3;;Średni;7;15;7:02;15:11;15
|
||||
3;;Średni;8;16;8:06;15:49;15
|
||||
3;P;Średni;7;15;7:24;16:40;15
|
||||
3;;Średni;8;16;8:02;16:05;15
|
||||
3;;Duży;8;16;8:05;16:01;15
|
||||
3;T;Średni;7;15;7:13;15:13;15
|
||||
3;;Średni;8;16;7:36;16:00;15
|
||||
3;T;Średni;7;15;6:55;15:11;15
|
||||
3;;Średni;9;17;9:09;17:14;15
|
|
7
Assets/Data/Tablica1.csv.meta
Normal file
7
Assets/Data/Tablica1.csv.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aee06166bc1488224b7742153c62a39d
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
162
Assets/Data/Tablica5.csv
Normal file
162
Assets/Data/Tablica5.csv
Normal file
@ -0,0 +1,162 @@
|
||||
Ranga stanowiska ,wybrany sposób parkowania,Klasyfikacja gabarytu ,od planwane,do planowane,od rzeczywiste,do rzeczywiste,czas miedzy sprawdzaniem miejsca
|
||||
1,,Du¿y,13,16,12:59,16:01,60
|
||||
1,T,Du¿y,13,16,13:05,16:10,60
|
||||
1,P,Du¿y,13:30,16:30,13:31,16:35,60
|
||||
1,P,Du¿y,14,17,13:57,17:01,60
|
||||
1,,Du¿y,13,16,13:08,16:15,60
|
||||
1,P,Du¿y,12:30,16:30,12:25,16:38,60
|
||||
1,T,Du¿y,12:30,15:30,12:31,15:29,60
|
||||
1,,Du¿y,13,15,12:56,14:58,60
|
||||
1,,Du¿y,13,16,12:54,16:02,60
|
||||
1,T,Du¿y,13:30,15:30,13:30,15:35,60
|
||||
1,,Du¿y,14,16,13:56,15:58,60
|
||||
1,P,Du¿y,12:30,17,12:27,16:59,60
|
||||
1,P,Du¿y,13,16,12:55,15:58,60
|
||||
1,,Du¿y,12:30,16,12:01,16:02,60
|
||||
1,,Du¿y,13,15:30,12:56,15:43,60
|
||||
2,,Du¿y,13,16,12:58,16:03,15
|
||||
2,T,Du¿y,13:30,16:30,13:28,16:35,15
|
||||
2,,Du¿y,14,17,14:04,16:58,15
|
||||
2,T,Du¿y,12:30,16,12:31,16:40,15
|
||||
2,P,Du¿y,13:30,15:30,13:27,15:31,15
|
||||
2,P,Du¿y,13:30,16:30,13:19,16:32,15
|
||||
2,P,Du¿y,13,16,12:58,16:04,15
|
||||
2,T,Du¿y,13,15,13:08,15:05,15
|
||||
2,T,Du¿y,13:30,15:30,13:28,15:32,15
|
||||
2,P,Du¿y,12:30,16:30,12:34,16:41,15
|
||||
2,,Du¿y,13:30,16:30,13:24,16:29,15
|
||||
2,,Du¿y,12:30,15:30,12:28,15:35,15
|
||||
2,,Du¿y,13,16,12:55,16:01,15
|
||||
2,T,Du¿y,13,15,12:58,15:19,15
|
||||
2,,Du¿y,13,17,12:55,17:01,15
|
||||
2,P,Du¿y,13:30,15:30,13:27,15:32,15
|
||||
2,,Du¿y,13:30,16:30,12:25,16:37,15
|
||||
2,T,Du¿y,14,17,14:02,17:05,15
|
||||
2,P,Du¿y,14,16,14:06,15:40,15
|
||||
2,,Du¿y,12:30,15:30,12:34,15:38,15
|
||||
2,T,Du¿y,13:30,16:30,13:29,16:39,15
|
||||
2,,Du¿y,13,16,13:10,16:13,15
|
||||
2,P,Du¿y,13,17,12:49,16:51,15
|
||||
2,P,Du¿y,14,17,14:04,17:11,15
|
||||
2,T,Du¿y,13,16,13:02,16:03,15
|
||||
2,,Du¿y,13:30,15:30,13:31,15:39,15
|
||||
2,,Du¿y,13,17,12:55,16:59,15
|
||||
2,,Du¿y,12:30,16:30,12:38,16:45,15
|
||||
2,P,Du¿y,13,16,12:45,16:10,15
|
||||
2,T,Du¿y,12:30,15:30,12:09,15:40,15
|
||||
2,,Du¿y,13:30,16:30,13:15,16:32,15
|
||||
2,,Du¿y,13:30,16:30,13:38,16:43,15
|
||||
2,,Du¿y,14,17,14:02,17:11,15
|
||||
2,P,Du¿y,12:30,16:30,12:35,16:47,15
|
||||
2,P,Du¿y,13,17,12:54,16:40,15
|
||||
2,,Du¿y,13:30,15:30,13:32,15:37,15
|
||||
2,,Du¿y,12:30,16:30,12:35,16:31,15
|
||||
2,P,Du¿y,12:30,15:30,12:43,15:47,15
|
||||
2,,Du¿y,13:30,17:30,13:36,17:30,15
|
||||
2,T,Du¿y,13,16,12:55,16:11,15
|
||||
2,P,Du¿y,12:30,16:30,12:39,16:44,15
|
||||
2,T,Du¿y,14,17,14:08,17:14,15
|
||||
2,,Du¿y,13:30,16,13:31,15:55,15
|
||||
2,,Du¿y,12:30,16,12:26,15:57,15
|
||||
2,,Du¿y,13,17,12:50,16:59,15
|
||||
2,P,Du¿y,14:00,17:30,13:57,17:34,15
|
||||
2,,Du¿y,13,16,12:57,16:01,15
|
||||
2,,Du¿y,13:30,16:30,13:32,16:30,15
|
||||
2,T,Du¿y,13,15:30,12:54,15:31,15
|
||||
2,T,Du¿y,14,17,13:49,16:58,15
|
||||
2,,Du¿y,13:30,17:30,13:30,17:28,15
|
||||
2,P,Du¿y,12:30,16:30,12:25,16:32,15
|
||||
2,T,Du¿y,13,17,13:04,17:01,15
|
||||
2,,Du¿y,14,17,13:58,17:03,15
|
||||
2,,Du¿y,12:30,16:30,12:29,16:10,15
|
||||
2,,Du¿y,13:30,17:30,13:28,17:33,15
|
||||
2,P,Du¿y,14,17,13:57,17:04,15
|
||||
2,P,Du¿y,13,16,13:04,15:52,15
|
||||
2,P,Du¿y,13:30,17,13:34,16:59,15
|
||||
2,,Du¿y,13:30,16,13:25,15:49,15
|
||||
2,T,Du¿y,13,17,13:04,17:01,15
|
||||
2,,Du¿y,14,17,13:58,17:03,15
|
||||
2,,Du¿y,12:30,16:30,12:29,16:10,15
|
||||
2,,Du¿y,13:30,17:30,13:28,17:33,15
|
||||
2,P,Du¿y,14,17,13:57,17:04,15
|
||||
2,P,Du¿y,13,16,13:04,15:52,15
|
||||
2,P,Du¿y,13:30,17,13:34,16:59,15
|
||||
2,,Du¿y,13:30,16,13:25,15:49,15
|
||||
2,P,Du¿y,14,17,13:57,17:04,15
|
||||
2,P,Du¿y,13,16,13:04,15:52,15
|
||||
2,P,Du¿y,13:30,17,13:34,16:59,15
|
||||
2,,Du¿y,13:30,16,13:25,15:49,15
|
||||
2,,Du¿y,13:30,16,13:25,15:49,15
|
||||
2,P,Ma³y,13,16,13:03,15:56,15
|
||||
2,,Œredni,13:30,16:30,13:28,16:34,15
|
||||
2,,Œredni,8,12,7:53,12:01,15
|
||||
2,,Ma³y,12:30,16:30,12:28,16:35,15
|
||||
2,,Œredni,13,17,12:56,16:59,15
|
||||
2,,Ma³y,7:30,12,7:24,11:58,15
|
||||
2,,Ma³y,8,13,8:01,13:07,15
|
||||
2,T,Œredni,8,13,8:10,13:12,15
|
||||
2,P,Œredni,8,11,8:45,11:02,15
|
||||
3,P,Œredni,8,10,7:53,10:01,15
|
||||
3,,Ma³y,9,11,8:53,10:45,15
|
||||
3,,Œredni,8,11,7:45,11:01,15
|
||||
3,T,Ma³y,9,11,9:30,10:59,15
|
||||
3,T,Œredni,9,11,9,11:10,15
|
||||
3,,Ma³y,10,11,9:50,11:04,15
|
||||
3,,Œredni,9,11,9:20,10:40,15
|
||||
3,P,Œredni,9,11,9,11:15,15
|
||||
3,,Œredni,9,11,8:45,11:23,15
|
||||
3,P,Ma³y,9,11,9,10:57,15
|
||||
3,,Œredni,10,11,9:50,10:45,15
|
||||
3,T,Œredni,9,11,9:30,11:06,15
|
||||
3,,Œredni,8,11,7:56,10:34,15
|
||||
3,T,Ma³y,9,11,09:04,11:03,15
|
||||
3,T,Œredni,8,13,7:50,12:10,15
|
||||
3,,Œredni,7,13,6:40,13:02,15
|
||||
3,,Ma³y,7,12,7:05,12:03,15
|
||||
3,P,Ma³y,10,13,9:49,12:58,15
|
||||
3,,Œredni,8,12,7:45,12:04,15
|
||||
3,P,Œredni,9,13,9:23,12:58,15
|
||||
3,,Ma³y,8,13,7:49,13:01,15
|
||||
3,,Œredni,7:30,12:30,7:27,12:36,15
|
||||
3,,Ma³y,8,13,8:10,12:50,15
|
||||
3,P,Ma³y,7:30,13,7:53,12:37,15
|
||||
3,,Œredni,8,13,7:53,13:01,15
|
||||
3,P,Œredni,7:30,13,7:35,13:00,15
|
||||
3,T,Œredni,8,12:30,7:53,12:40,15
|
||||
3,,Ma³y,8,13,7:57,13:01,15
|
||||
3,P,Ma³y,8,13,7:45,13:10,15
|
||||
3,P,Ma³y,8,12:30,7:49,12:25,15
|
||||
3,,Œredni,10,13,10:05,13:08,15
|
||||
3,T,Œredni,7,12,7,12:10,15
|
||||
3,P,Ma³y,8,13,8:05,12:55,15
|
||||
3,,Ma³y,8,13,7:45,13:10,15
|
||||
3,,Ma³y,8,13,7:50,12:58,15
|
||||
3,T,Œredni,8,12,8:03,12:49,15
|
||||
3,,Œredni,8,10,8,9:58,15
|
||||
3,P,Ma³y,7:30,12:30,7:25,12:32,15
|
||||
3,,Ma³y,8,12,8:02,12:05,15
|
||||
3,P,Œredni,7:30,13,7:28,12:40,15
|
||||
3,T,Œredni,7:30,12:30,7:15,12:17,15
|
||||
3,,Ma³y,8,12:30,7:45,12:10,15
|
||||
3,P,Œredni,7,13,6:58,13:02,15
|
||||
3,,Œredni,8,12,7:57,11:58,15
|
||||
3,P,Ma³y,8,13,8:05,13:10,15
|
||||
3,,Œredni,8,12:30,8:01,12:34,15
|
||||
3,T,Ma³y,8,13,7:47,13:01,15
|
||||
3,,Ma³y,7,12,6:57,12,15
|
||||
3,T,Œredni,7:30,12:30,7:15,12:17,15
|
||||
3,,Ma³y,8,12:30,7:45,12:10,15
|
||||
3,P,Œredni,7,13,6:58,13:02,15
|
||||
3,,Œredni,8,12,7:57,11:58,15
|
||||
3,P,Ma³y,8,13,8:05,13:10,15
|
||||
3,,Œredni,8,12:30,8:01,12:34,15
|
||||
3,T,Ma³y,8,13,7:47,13:01,15
|
||||
3,,Ma³y,7,12,6:57,12,15
|
||||
3,T,Ma³y,8,13,7:45,12:59,15
|
||||
3,P,Œredni,8,13,8:02,12:47,15
|
||||
3,P,Œredni,8:30,13,8:21,12:48,15
|
||||
3,,Ma³y,9,13,9:02,13:04,15
|
||||
3,T,Œredni,9,12:30,8:57,12:35,15
|
||||
3,T,Ma³y,8,13,8:04,13:12,15
|
||||
3,T,Ma³y,8,13,7:52,12:57,15
|
||||
3,,Ma³y,8,13,7:50,12:59,15
|
|
7
Assets/Data/Tablica5.csv.meta
Normal file
7
Assets/Data/Tablica5.csv.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2074fc460da33aa67b2544c19e1280e0
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -2932,7 +2932,7 @@ MonoBehaviour:
|
||||
mainPlanContainer: {fileID: 557435656}
|
||||
emergencyPlanContainer: {fileID: 632826360}
|
||||
reconfigurationToggle: {fileID: 441283505}
|
||||
defaultPath: /home/davp/Projects/Customers/Parking/Assets/Data/Tablica5_2022-09-09.csv
|
||||
defaultPath: /home/davp/Projects/Customers/Parking/Assets/Data/Tablica5.csv
|
||||
--- !u!1 &1347097428
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -36,8 +36,13 @@ namespace Parking
|
||||
{
|
||||
Parked = false;
|
||||
Rejected = false;
|
||||
if (Spot != null)
|
||||
Reserved = false;
|
||||
ReservedSpot = null;
|
||||
if (Spot != null) {
|
||||
Spot.Free = true;
|
||||
Spot.Reserved = false;
|
||||
}
|
||||
|
||||
Spot = null;
|
||||
if (GameObject != null)
|
||||
Object.Destroy(GameObject);
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
using UnityEngine.UI;
|
||||
@ -130,20 +131,28 @@ namespace Parking
|
||||
|
||||
private void ReserveSpotsInTimeRange(float hours)
|
||||
{
|
||||
// for (int j = 3; j >= 0; j--)
|
||||
// foreach (Spot spot in _spotMap[j]) {
|
||||
// spot.Reserved = false;
|
||||
// spot.ReservedPriority = 0;
|
||||
// }
|
||||
for (int j = 3; j >= 0; j--)
|
||||
foreach (Spot spot in _spotMap[j]) {
|
||||
spot.Reserved = false;
|
||||
spot.ReservedPriority = 0;
|
||||
}
|
||||
|
||||
foreach (Driver driver in DataImporter.Drivers) {
|
||||
driver.Reserved = false;
|
||||
}
|
||||
|
||||
float rightTime = 10.0f;//(float)_currentTime.TotalHours;
|
||||
float leftTime = 16.0f;//(float)(_currentTime + TimeSpan.FromHours(hours)).TotalHours;
|
||||
|
||||
TimeSpan maxArrivalTime = _currentTime + TimeSpan.FromHours(hours);
|
||||
List<Driver> nextDrivers = new List<Driver>();
|
||||
foreach (Driver driver in DataImporter.Drivers) {
|
||||
if (driver.RealArrival >= _currentTime && driver.PlannedArrival < maxArrivalTime) {
|
||||
if (driver.RealArrival >= _currentTime && driver.PlannedArrival < maxArrivalTime && !driver.Reserved) {
|
||||
nextDrivers.Add(driver);
|
||||
}
|
||||
}
|
||||
nextDrivers.Sort(((a, b) => Comparer<TimeSpan>.Default.Compare(a.PlannedDeparture, b.PlannedDeparture)));
|
||||
// nextDrivers.Sort(((a, b) => Comparer<TimeSpan>.Default.Compare(a.PlannedDeparture, b.PlannedDeparture)));
|
||||
nextDrivers.Sort(((a, b) => Comparer<TimeSpan>.Default.Compare(a.PlannedArrival, b.PlannedArrival)));
|
||||
|
||||
List<Spot> availableSpots = new List<Spot>();
|
||||
|
||||
@ -152,21 +161,40 @@ namespace Parking
|
||||
if (!spot.Reserved && spot.Free)
|
||||
availableSpots.Add(spot);
|
||||
|
||||
availableSpots.Sort(((a, b) => Comparer<float>.Default.Compare(a.Position.x, b.Position.x)));
|
||||
availableSpots.Reverse();
|
||||
// availableSpots.Reverse();
|
||||
|
||||
// leftTime = (float)nextDrivers.Max(d => d.PlannedDeparture).TotalHours;
|
||||
|
||||
for (int i = 0; i < nextDrivers.Count; i++) {
|
||||
Driver driver = nextDrivers[i];
|
||||
|
||||
// float driverTime = (float)driver.PlannedDeparture.TotalHours;
|
||||
float driverTime = (float)driver.RealDeparture.TotalHours;
|
||||
float timeProgress = (driverTime - rightTime) / (leftTime - rightTime);
|
||||
float xPosition = Width / 2.0f - (Width * timeProgress);
|
||||
availableSpots.Sort(((a, b) => Comparer<float>.Default.Compare(Mathf.Abs(xPosition - a.Position.x), Mathf.Abs(xPosition - b.Position.x))));
|
||||
|
||||
bool useBottomLane = true;
|
||||
for (int j = 0; j < availableSpots.Count; j++) {
|
||||
Spot spot = availableSpots[j];
|
||||
if (driver.Size == spot.Size && !spot.Reserved) {
|
||||
if (driver.Size == spot.Size && !spot.Reserved && (spot.Lane != 0 || useBottomLane)) {
|
||||
spot.Reserved = true;
|
||||
driver.Reserved = true;
|
||||
driver.ReservedSpot = spot;
|
||||
break;
|
||||
}
|
||||
|
||||
// if (Mathf.Abs(spot.Position.x - xPosition) > 20.0f) {
|
||||
// if (useBottomLane)
|
||||
// break;
|
||||
// // useBottomLane = true;
|
||||
// // j = -1;
|
||||
// }
|
||||
}
|
||||
}
|
||||
// done:
|
||||
// {
|
||||
// }
|
||||
|
||||
// for (int i = 0; i < Math.Min(DataImporter.Drivers.Count, _initialConfigurationSpotCount); i++) {
|
||||
// bool found = false;
|
||||
@ -213,10 +241,10 @@ namespace Parking
|
||||
if (_reconfigurationActive)
|
||||
ReconfigureSpots();
|
||||
|
||||
// if(_currentTime.Hours % 3 == 0 && _currentTime.Minutes == 0)
|
||||
// ReserveSpotsInTimeRange(3);
|
||||
if(_currentTime.Hours == 6 && _currentTime.Minutes == 0)
|
||||
ReserveSpotsInTimeRange(10);
|
||||
if((_currentTime.Hours - 6) % 3 == 0 && _currentTime.Minutes == 0)
|
||||
ReserveSpotsInTimeRange(3);
|
||||
// if(_currentTime.Hours == 6 && _currentTime.Minutes == 0)
|
||||
// ReserveSpotsInTimeRange(10);
|
||||
|
||||
UpdateIncomingOutgoingDrivers();
|
||||
|
||||
@ -260,6 +288,7 @@ namespace Parking
|
||||
}
|
||||
else if (leftTheParking) {
|
||||
driver.Spot.Reserved = false;
|
||||
driver.Reserved = false;
|
||||
driver.Reset();
|
||||
}
|
||||
else if (reservedButTimedout) {
|
||||
@ -464,16 +493,24 @@ namespace Parking
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
List<int> conflictingSpots = GetConflictingSpotsLower(lowerSpot.GameObject.transform.position, 0, false,
|
||||
List<int> conflictingSpots = GetConflictingSpotsLower(lowerSpot.GameObject.transform.position, 0, true,
|
||||
lowerSpot.Size, 0.0f);
|
||||
|
||||
// verify we can delete them
|
||||
int maxASpotsDeleted = GetSpotCountOfSize(Size.A) - 2;
|
||||
int maxBSpotsDeleted = GetSpotCountOfSize(Size.B) - 2;
|
||||
bool allSpotsFree = true;
|
||||
foreach (int conflictingSpotId in conflictingSpots) {
|
||||
Spot conflictingSpot = _spotMap[0][conflictingSpotId];
|
||||
if (conflictingSpot.Size == Size.A)
|
||||
maxASpotsDeleted--;
|
||||
if (conflictingSpot.Size == Size.B)
|
||||
maxBSpotsDeleted--;
|
||||
if (!conflictingSpot.Free || conflictingSpot.Reserved)
|
||||
allSpotsFree = false;
|
||||
}
|
||||
if(maxASpotsDeleted < 0 || maxBSpotsDeleted < 0)
|
||||
continue;
|
||||
if(!allSpotsFree)
|
||||
continue;
|
||||
|
||||
@ -518,7 +555,6 @@ namespace Parking
|
||||
// Try regeneration before returning false
|
||||
return RegenerateSpots(newSize);
|
||||
}
|
||||
// TODO: Add new spot generation (lower lane)
|
||||
|
||||
foreach (List<Spot> currentLaneSpots in _spotMap)
|
||||
for (int i = 0; i < currentLaneSpots.Count; i++) {
|
||||
@ -721,12 +757,40 @@ namespace Parking
|
||||
|
||||
float lastRightBorder = -Width / 2.0f + 5.5f;
|
||||
float spaceNeeded = SpotHeights[(int)size];
|
||||
// var expectedList = _spotMap[0].OrderByDescending(x => x.Position.x);
|
||||
|
||||
for (int i = _spotMap[0].Count - 1; i >= 0; i--) {
|
||||
Spot currentSpot = _spotMap[0][i];
|
||||
|
||||
if (currentSpot.LeftBorder - lastRightBorder >= spaceNeeded) {
|
||||
|
||||
List<int> conflictingSpots = new ();
|
||||
for (int i = 0; i < _spotMap[0].Count; i++) {
|
||||
Spot spot = _spotMap[0][i];
|
||||
if (spot.Free && !spot.Reserved) {
|
||||
conflictingSpots.Add(i);
|
||||
}
|
||||
}
|
||||
|
||||
int removed = 0;
|
||||
conflictingSpots.Sort();
|
||||
|
||||
foreach (int conflictingSpotId in conflictingSpots) {
|
||||
if(_spotMap[0][conflictingSpotId - removed].Size == Size.A && GetSpotCountOfSize(Size.A) == 2)
|
||||
continue;
|
||||
if(_spotMap[0][conflictingSpotId - removed].Size == Size.B && GetSpotCountOfSize(Size.B) == 2)
|
||||
continue;
|
||||
Destroy(_spotMap[0][conflictingSpotId - removed].GameObject);
|
||||
_spotMap[0].RemoveAt(conflictingSpotId - removed);
|
||||
removed++;
|
||||
}
|
||||
|
||||
for (int i = _spotMap[0].Count - 1; i >= -1; i--) {
|
||||
|
||||
float leftBorder;
|
||||
if (i >= 0) {
|
||||
leftBorder = _spotMap[0][i].LeftBorder;
|
||||
}
|
||||
else
|
||||
leftBorder = Width / 2.0f;
|
||||
|
||||
if (leftBorder - lastRightBorder >= spaceNeeded) {
|
||||
Spot newSpot = new Spot(size, false);
|
||||
newPosition.x = (lastRightBorder + SpotHeights[(int)size] / 2.0f);
|
||||
newPosition.y = (-Height / 2.0f) + 2.25f / 2.0f;
|
||||
@ -737,7 +801,8 @@ namespace Parking
|
||||
_spotMap[0].Sort((a, b) => Comparer<float>.Default.Compare(b.Position.x, a.Position.x));
|
||||
return true;
|
||||
}
|
||||
lastRightBorder = currentSpot.RightBorder;
|
||||
if (i >= 0)
|
||||
lastRightBorder = _spotMap[0][i].RightBorder;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user