fr.jeanf.scenemanagement 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -107,12 +107,13 @@ namespace jeanf.scenemanagement
107
107
  {
108
108
  if (zone == null) continue;
109
109
 
110
+ // CHANGED: Collect ALL volumes for this zone, not just the first one
110
111
  foreach (var volumeAuth in volumeAuthorings)
111
112
  {
112
113
  if (volumeAuth.zone != null && volumeAuth.zone.id.Equals(zone.id))
113
114
  {
114
115
  regionVolumeMap[region].Add(volumeAuth);
115
- break; // Only add one volume per zone
116
+ // REMOVED: break statement - now collects all volumes for the zone
116
117
  }
117
118
  }
118
119
  }
@@ -125,35 +126,45 @@ namespace jeanf.scenemanagement
125
126
  var volumes = kvp.Value;
126
127
  var color = _regionColors[region];
127
128
 
128
- // Draw volumes (actual size, no labels)
129
- for (int i = 0; i < volumes.Count; i++)
129
+ // Draw all volumes for this region
130
+ foreach (var volume in volumes)
130
131
  {
131
- var currentVolume = volumes[i];
132
- if (currentVolume == null) continue;
132
+ if (volume == null) continue;
133
133
 
134
- var currentPos = currentVolume.transform.position;
135
- var currentScale = currentVolume.transform.localScale;
134
+ var pos = volume.transform.position;
135
+ var scale = volume.transform.localScale;
136
136
 
137
137
  Handles.color = color;
138
- Handles.DrawWireCube(currentPos, currentScale);
138
+ Handles.DrawWireCube(pos, scale);
139
139
  }
140
140
 
141
- // Draw connections between volumes in the same region (red dotted lines)
142
- for (int i = 0; i < volumes.Count; i++)
141
+ // CHANGED: Draw connections between zone centers, not individual volumes
142
+ var zoneVolumeGroups = new Dictionary<string, List<VolumeAuthoring>>();
143
+ foreach (var volume in volumes)
143
144
  {
144
- var currentVolume = volumes[i];
145
- if (currentVolume == null) continue;
145
+ if (volume?.zone == null) continue;
146
146
 
147
- var currentPos = currentVolume.transform.position;
147
+ var zoneId = volume.zone.id.ToString();
148
+ if (!zoneVolumeGroups.ContainsKey(zoneId))
149
+ zoneVolumeGroups[zoneId] = new List<VolumeAuthoring>();
148
150
 
149
- for (int j = i + 1; j < volumes.Count; j++)
151
+ zoneVolumeGroups[zoneId].Add(volume);
152
+ }
153
+
154
+ // Draw connections between zone centers (red dotted lines)
155
+ var zoneIds = zoneVolumeGroups.Keys.ToList();
156
+ for (int i = 0; i < zoneIds.Count; i++)
157
+ {
158
+ for (int j = i + 1; j < zoneIds.Count; j++)
150
159
  {
151
- var otherVolume = volumes[j];
152
- if (otherVolume == null) continue;
160
+ var zoneA = zoneVolumeGroups[zoneIds[i]];
161
+ var zoneB = zoneVolumeGroups[zoneIds[j]];
162
+
163
+ var centerA = CalculateZoneCenter(zoneA);
164
+ var centerB = CalculateZoneCenter(zoneB);
153
165
 
154
- var otherPos = otherVolume.transform.position;
155
166
  Handles.color = Color.red;
156
- Handles.DrawDottedLine(currentPos, otherPos, 5f);
167
+ Handles.DrawDottedLine(centerA, centerB, 5f);
157
168
  }
158
169
  }
159
170
  }
@@ -163,14 +174,15 @@ namespace jeanf.scenemanagement
163
174
  {
164
175
  if (landing.landingZone == null || landing.region == null) continue;
165
176
 
166
- var landingVolume = System.Array.Find(volumeAuthorings,
167
- v => v.zone != null && v.zone.id.Equals(landing.landingZone.id));
177
+ // CHANGED: Find ALL volumes for the landing zone
178
+ var landingVolumes = System.Array.FindAll(volumeAuthorings,
179
+ v => v.zone != null && v.zone.id.Equals(landing.landingZone.id)).ToList();
168
180
 
169
- if (landingVolume == null) continue;
181
+ if (landingVolumes.Count == 0) continue;
170
182
 
171
- var landingPos = landingVolume.transform.position;
183
+ var landingCenter = CalculateZoneCenter(landingVolumes);
172
184
 
173
- // Connect landing zone to volumes in OTHER regions only
185
+ // Connect landing zone center to volumes in OTHER regions only
174
186
  foreach (var kvp in regionVolumeMap)
175
187
  {
176
188
  var region = kvp.Key;
@@ -178,13 +190,16 @@ namespace jeanf.scenemanagement
178
190
 
179
191
  if (region.id.Equals(landing.region.id)) continue; // Skip same region
180
192
 
181
- foreach (var regionVolume in volumes)
193
+ // Group volumes by zone and connect to zone centers
194
+ var zoneGroups = volumes.GroupBy(v => v.zone?.id.ToString()).Where(g => !string.IsNullOrEmpty(g.Key));
195
+
196
+ foreach (var zoneGroup in zoneGroups)
182
197
  {
183
- if (regionVolume != null)
184
- {
185
- Handles.color = Color.yellow;
186
- Handles.DrawLine(landingPos, regionVolume.transform.position);
187
- }
198
+ var zoneVolumes = zoneGroup.ToList();
199
+ var zoneCenter = CalculateZoneCenter(zoneVolumes);
200
+
201
+ Handles.color = Color.yellow;
202
+ Handles.DrawLine(landingCenter, zoneCenter);
188
203
  }
189
204
  }
190
205
  }
@@ -194,18 +209,36 @@ namespace jeanf.scenemanagement
194
209
  {
195
210
  if (landing.landingZone == null || landing.region == null) continue;
196
211
 
197
- var landingVolume = System.Array.Find(volumeAuthorings,
198
- v => v.zone != null && v.zone.id.Equals(landing.landingZone.id));
212
+ // CHANGED: Find ALL volumes for the landing zone
213
+ var landingVolumes = System.Array.FindAll(volumeAuthorings,
214
+ v => v.zone != null && v.zone.id.Equals(landing.landingZone.id)).ToList();
199
215
 
200
- if (landingVolume == null) continue;
216
+ if (landingVolumes.Count == 0) continue;
201
217
 
202
- var landingPos = landingVolume.transform.position;
203
- var landingScale = landingVolume.transform.localScale;
204
-
205
- // Draw landing zone in blue, actual size
206
- Handles.color = Color.blue;
207
- Handles.DrawWireCube(landingPos, landingScale);
218
+ // Draw all landing zone volumes in blue, actual size
219
+ foreach (var landingVolume in landingVolumes)
220
+ {
221
+ var landingPos = landingVolume.transform.position;
222
+ var landingScale = landingVolume.transform.localScale;
223
+
224
+ Handles.color = Color.blue;
225
+ Handles.DrawWireCube(landingPos, landingScale);
226
+ }
227
+ }
228
+ }
229
+
230
+ // Helper method to calculate the center point of a multi-volume zone
231
+ private Vector3 CalculateZoneCenter(List<VolumeAuthoring> volumes)
232
+ {
233
+ if (volumes.Count == 0) return Vector3.zero;
234
+ if (volumes.Count == 1) return volumes[0].transform.position;
235
+
236
+ Vector3 sum = Vector3.zero;
237
+ foreach (var volume in volumes)
238
+ {
239
+ sum += volume.transform.position;
208
240
  }
241
+ return sum / volumes.Count;
209
242
  }
210
243
 
211
244
  private void DrawLandingZoneConnections(RegionConnectivity connectivity, VolumeAuthoring[] volumeAuthorings, Dictionary<Region, List<VolumeAuthoring>> regionVolumeMap)
@@ -214,18 +247,26 @@ namespace jeanf.scenemanagement
214
247
  {
215
248
  if (landing.landingZone == null || landing.region == null) continue;
216
249
 
217
- var landingVolume = System.Array.Find(volumeAuthorings,
218
- v => v.zone != null && v.zone.id.Equals(landing.landingZone.id));
250
+ // CHANGED: Find ALL volumes for the landing zone
251
+ var landingVolumes = System.Array.FindAll(volumeAuthorings,
252
+ v => v.zone != null && v.zone.id.Equals(landing.landingZone.id)).ToList();
253
+
254
+ if (landingVolumes.Count == 0) continue;
219
255
 
220
- if (landingVolume == null) continue;
256
+ var landingCenter = CalculateZoneCenter(landingVolumes);
221
257
 
222
- var landingPos = landingVolume.transform.position;
223
- var landingScale = landingVolume.transform.localScale;
258
+ // Draw all landing zone volumes
259
+ foreach (var landingVolume in landingVolumes)
260
+ {
261
+ var landingPos = landingVolume.transform.position;
262
+ var landingScale = landingVolume.transform.localScale;
263
+
264
+ Handles.color = Color.white;
265
+ Handles.DrawWireCube(landingPos, landingScale * 1.2f);
266
+ }
224
267
 
225
- Handles.color = Color.white;
226
- Handles.DrawWireCube(landingPos, landingScale * 1.2f);
227
- Handles.Label(landingPos + Vector3.up * (landingScale.y * 0.8f),
228
- $"LANDING\n{landing.landingZone.zoneName}",
268
+ Handles.Label(landingCenter + Vector3.up * 2f,
269
+ $"LANDING\n{landing.landingZone.zoneName}\n({landingVolumes.Count} volumes)",
229
270
  new GUIStyle(GUI.skin.label) {
230
271
  normal = { textColor = Color.white },
231
272
  fontStyle = FontStyle.Bold
@@ -238,13 +279,16 @@ namespace jeanf.scenemanagement
238
279
 
239
280
  if (region.id.Equals(landing.region.id)) continue;
240
281
 
241
- foreach (var regionVolume in volumes)
282
+ // Group volumes by zone and connect to zone centers
283
+ var zoneGroups = volumes.GroupBy(v => v.zone?.id.ToString()).Where(g => !string.IsNullOrEmpty(g.Key));
284
+
285
+ foreach (var zoneGroup in zoneGroups)
242
286
  {
243
- if (regionVolume != null)
244
- {
245
- Handles.color = Color.yellow;
246
- Handles.DrawLine(landingPos, regionVolume.transform.position);
247
- }
287
+ var zoneVolumes = zoneGroup.ToList();
288
+ var zoneCenter = CalculateZoneCenter(zoneVolumes);
289
+
290
+ Handles.color = Color.yellow;
291
+ Handles.DrawLine(landingCenter, zoneCenter);
248
292
  }
249
293
  }
250
294
  }
@@ -344,11 +388,13 @@ namespace jeanf.scenemanagement
344
388
  {
345
389
  if (zone == null) continue;
346
390
 
391
+ // CHANGED: Collect ALL volumes for this zone
347
392
  foreach (var volumeAuth in volumeAuthorings)
348
393
  {
349
394
  if (volumeAuth.zone != null && volumeAuth.zone.id.Equals(zone.id))
350
395
  {
351
396
  regionVolumeMap[region].Add(volumeAuth);
397
+ // REMOVED: break statement
352
398
  }
353
399
  }
354
400
  }
@@ -362,26 +408,51 @@ namespace jeanf.scenemanagement
362
408
 
363
409
  Handles.color = color;
364
410
 
365
- for (int i = 0; i < volumes.Count; i++)
411
+ // Draw all volumes in this region
412
+ foreach (var volume in volumes)
366
413
  {
367
- var currentVolume = volumes[i];
368
- if (currentVolume == null) continue;
414
+ if (volume == null) continue;
369
415
 
370
- var currentPos = currentVolume.transform.position;
371
- var currentScale = currentVolume.transform.localScale;
416
+ var currentPos = volume.transform.position;
417
+ var currentScale = volume.transform.localScale;
372
418
 
373
419
  Handles.DrawWireCube(currentPos, currentScale);
374
- Handles.Label(currentPos + Vector3.up * (currentScale.y * 0.6f),
375
- $"{region.levelName}\n{currentVolume.zone.zoneName}",
376
- new GUIStyle(GUI.skin.label) { normal = { textColor = color } });
377
420
 
378
- for (int j = i + 1; j < volumes.Count; j++)
421
+ // Only show label for first volume of each zone to avoid clutter
422
+ var isFirstVolumeOfZone = volumes.Where(v => v?.zone?.id == volume.zone?.id).First() == volume;
423
+ if (isFirstVolumeOfZone)
379
424
  {
380
- var otherVolume = volumes[j];
381
- if (otherVolume == null) continue;
425
+ Handles.Label(currentPos + Vector3.up * (currentScale.y * 0.6f),
426
+ $"{region.levelName}\n{volume.zone.zoneName}",
427
+ new GUIStyle(GUI.skin.label) { normal = { textColor = color } });
428
+ }
429
+ }
430
+
431
+ // CHANGED: Draw connections between zone centers
432
+ var zoneVolumeGroups = new Dictionary<string, List<VolumeAuthoring>>();
433
+ foreach (var volume in volumes)
434
+ {
435
+ if (volume?.zone == null) continue;
436
+
437
+ var zoneId = volume.zone.id.ToString();
438
+ if (!zoneVolumeGroups.ContainsKey(zoneId))
439
+ zoneVolumeGroups[zoneId] = new List<VolumeAuthoring>();
440
+
441
+ zoneVolumeGroups[zoneId].Add(volume);
442
+ }
443
+
444
+ var zoneIds = zoneVolumeGroups.Keys.ToList();
445
+ for (int i = 0; i < zoneIds.Count; i++)
446
+ {
447
+ for (int j = i + 1; j < zoneIds.Count; j++)
448
+ {
449
+ var zoneA = zoneVolumeGroups[zoneIds[i]];
450
+ var zoneB = zoneVolumeGroups[zoneIds[j]];
451
+
452
+ var centerA = CalculateZoneCenter(zoneA);
453
+ var centerB = CalculateZoneCenter(zoneB);
382
454
 
383
- var otherPos = otherVolume.transform.position;
384
- Handles.DrawDottedLine(currentPos, otherPos, 5f);
455
+ Handles.DrawDottedLine(centerA, centerB, 5f);
385
456
  }
386
457
  }
387
458
  }
@@ -389,24 +460,45 @@ namespace jeanf.scenemanagement
389
460
  DrawLandingZoneConnections(connectivity, volumeAuthorings, regionVolumeMap);
390
461
  }
391
462
 
463
+ private Vector3 CalculateZoneCenter(List<VolumeAuthoring> volumes)
464
+ {
465
+ if (volumes.Count == 0) return Vector3.zero;
466
+ if (volumes.Count == 1) return volumes[0].transform.position;
467
+
468
+ Vector3 sum = Vector3.zero;
469
+ foreach (var volume in volumes)
470
+ {
471
+ sum += volume.transform.position;
472
+ }
473
+ return sum / volumes.Count;
474
+ }
475
+
392
476
  private void DrawLandingZoneConnections(RegionConnectivity connectivity, VolumeAuthoring[] volumeAuthorings, Dictionary<Region, List<VolumeAuthoring>> regionVolumeMap)
393
477
  {
394
478
  foreach (var landing in connectivity.landingZones)
395
479
  {
396
480
  if (landing.landingZone == null || landing.region == null) continue;
397
481
 
398
- var landingVolume = System.Array.Find(volumeAuthorings,
399
- v => v.zone != null && v.zone.id.Equals(landing.landingZone.id));
482
+ // CHANGED: Find ALL volumes for the landing zone
483
+ var landingVolumes = System.Array.FindAll(volumeAuthorings,
484
+ v => v.zone != null && v.zone.id.Equals(landing.landingZone.id)).ToList();
485
+
486
+ if (landingVolumes.Count == 0) continue;
400
487
 
401
- if (landingVolume == null) continue;
488
+ var landingCenter = CalculateZoneCenter(landingVolumes);
402
489
 
403
- var landingPos = landingVolume.transform.position;
404
- var landingScale = landingVolume.transform.localScale;
490
+ // Draw all landing zone volumes
491
+ foreach (var landingVolume in landingVolumes)
492
+ {
493
+ var landingPos = landingVolume.transform.position;
494
+ var landingScale = landingVolume.transform.localScale;
495
+
496
+ Handles.color = Color.white;
497
+ Handles.DrawWireCube(landingPos, landingScale * 1.2f);
498
+ }
405
499
 
406
- Handles.color = Color.white;
407
- Handles.DrawWireCube(landingPos, landingScale * 1.2f);
408
- Handles.Label(landingPos + Vector3.up * (landingScale.y * 0.8f),
409
- $"LANDING\n{landing.landingZone.zoneName}",
500
+ Handles.Label(landingCenter + Vector3.up * 2f,
501
+ $"LANDING\n{landing.landingZone.zoneName}\n({landingVolumes.Count} volumes)",
410
502
  new GUIStyle(GUI.skin.label) {
411
503
  normal = { textColor = Color.white },
412
504
  fontStyle = FontStyle.Bold
@@ -419,13 +511,16 @@ namespace jeanf.scenemanagement
419
511
 
420
512
  if (region.id.Equals(landing.region.id)) continue;
421
513
 
422
- foreach (var regionVolume in volumes)
514
+ // Group by zone and connect to zone centers
515
+ var zoneGroups = volumes.GroupBy(v => v.zone?.id.ToString()).Where(g => !string.IsNullOrEmpty(g.Key));
516
+
517
+ foreach (var zoneGroup in zoneGroups)
423
518
  {
424
- if (regionVolume != null)
425
- {
426
- Handles.color = Color.yellow;
427
- Handles.DrawLine(landingPos, regionVolume.transform.position);
428
- }
519
+ var zoneVolumes = zoneGroup.ToList();
520
+ var zoneCenter = CalculateZoneCenter(zoneVolumes);
521
+
522
+ Handles.color = Color.yellow;
523
+ Handles.DrawLine(landingCenter, zoneCenter);
429
524
  }
430
525
  }
431
526
  }
@@ -623,99 +718,100 @@ namespace jeanf.scenemanagement
623
718
  }
624
719
 
625
720
  var regionColor = _regionColors[currentRegion];
626
- var selectedPos = selectedVolume.transform.position;
627
- var selectedScale = selectedVolume.transform.localScale;
721
+
722
+ // CHANGED: Calculate center of the selected zone (which may have multiple volumes)
723
+ var selectedZoneVolumes = System.Array.FindAll(allVolumeAuthorings,
724
+ v => v.zone != null && v.zone.id.Equals(currentZone.id)).ToList();
725
+ var selectedZoneCenter = CalculateZoneCenter(selectedZoneVolumes);
628
726
 
629
727
  // Priority 3: Draw other connections first (same region) - red dotted lines
630
728
  foreach (var zone in currentRegion.zonesInThisRegion)
631
729
  {
632
730
  if (zone == null || zone == currentZone) continue;
633
731
 
634
- foreach (var volumeAuth in allVolumeAuthorings)
732
+ // CHANGED: Find ALL volumes for this zone and draw connections to zone center
733
+ var zoneVolumes = System.Array.FindAll(allVolumeAuthorings,
734
+ v => v.zone != null && v.zone.id.Equals(zone.id)).ToList();
735
+
736
+ if (zoneVolumes.Count == 0) continue;
737
+
738
+ var zoneCenter = CalculateZoneCenter(zoneVolumes);
739
+
740
+ // Draw all volumes in this zone
741
+ foreach (var volume in zoneVolumes)
635
742
  {
636
- if (volumeAuth == null || volumeAuth.zone == null) continue;
637
-
638
- if (volumeAuth.zone.id.Equals(zone.id))
639
- {
640
- var otherPos = volumeAuth.transform.position;
641
- var otherScale = volumeAuth.transform.localScale;
642
-
643
- // Draw the volume
644
- Handles.color = regionColor;
645
- Handles.DrawWireCube(otherPos, otherScale);
646
-
647
- // Draw potential connection (red dotted line)
648
- Handles.color = Color.red;
649
- Handles.DrawDottedLine(selectedPos, otherPos, 5f);
650
- break; // Only draw one volume per zone
651
- }
743
+ Handles.color = regionColor;
744
+ Handles.DrawWireCube(volume.transform.position, volume.transform.localScale);
652
745
  }
746
+
747
+ // Draw connection line between zone centers
748
+ Handles.color = Color.red;
749
+ Handles.DrawDottedLine(selectedZoneCenter, zoneCenter, 5f);
653
750
  }
654
751
 
655
- // Show actual landing zone connectivity - yellow solid lines
752
+ // Handle landing zone connections
656
753
  var landingConnection = _foundConnectivity.landingZones.FirstOrDefault(l => l.landingZone == currentZone);
657
754
  if (landingConnection != null)
658
755
  {
659
- // This volume IS a landing zone - show connections to OTHER regions
756
+ // This zone IS a landing zone - show connections to OTHER regions
660
757
  foreach (var region in _foundConnectivity.activeRegions)
661
758
  {
662
- if (region == null || region.id.Equals(currentRegion.id)) continue; // Skip same region
663
-
664
- if (!_regionColors.ContainsKey(region))
665
- {
666
- var colorIndex = _regionColors.Count % _predefinedColors.Length;
667
- _regionColors[region] = _predefinedColors[colorIndex];
668
- }
759
+ if (region == null || region.id.Equals(currentRegion.id)) continue;
669
760
 
670
761
  foreach (var zone in region.zonesInThisRegion)
671
762
  {
672
763
  if (zone == null) continue;
673
764
 
674
- foreach (var volumeAuth in allVolumeAuthorings)
765
+ var zoneVolumes = System.Array.FindAll(allVolumeAuthorings,
766
+ v => v.zone != null && v.zone.id.Equals(zone.id)).ToList();
767
+
768
+ if (zoneVolumes.Count == 0) continue;
769
+
770
+ var zoneCenter = CalculateZoneCenter(zoneVolumes);
771
+
772
+ // Draw zone volumes
773
+ foreach (var volume in zoneVolumes)
675
774
  {
676
- if (volumeAuth == null || volumeAuth.zone == null) continue;
677
-
678
- if (volumeAuth.zone.id.Equals(zone.id))
775
+ if (!_regionColors.ContainsKey(region))
679
776
  {
680
- var otherPos = volumeAuth.transform.position;
681
- var otherScale = volumeAuth.transform.localScale;
682
-
683
- // Draw the target volume
684
- Handles.color = _regionColors[region];
685
- Handles.DrawWireCube(otherPos, otherScale);
686
-
687
- // Draw ACTUAL landing zone connection (yellow solid line)
688
- Handles.color = Color.yellow;
689
- Handles.DrawLine(selectedPos, otherPos);
690
- break; // Only draw one volume per zone
777
+ var colorIndex = _regionColors.Count % _predefinedColors.Length;
778
+ _regionColors[region] = _predefinedColors[colorIndex];
691
779
  }
780
+
781
+ Handles.color = _regionColors[region];
782
+ Handles.DrawWireCube(volume.transform.position, volume.transform.localScale);
692
783
  }
784
+
785
+ // Draw landing connection
786
+ Handles.color = Color.yellow;
787
+ Handles.DrawLine(selectedZoneCenter, zoneCenter);
693
788
  }
694
789
  }
695
790
  }
696
791
 
697
- // Show connections FROM other landing zones TO this volume
792
+ // Draw connections FROM other landing zones TO this zone
698
793
  foreach (var landing in _foundConnectivity.landingZones)
699
794
  {
700
795
  if (landing.landingZone == null || landing.region == null) continue;
701
- if (landing.landingZone == currentZone) continue; // Skip self
796
+ if (landing.landingZone == currentZone) continue;
797
+
798
+ var landingVolumes = System.Array.FindAll(allVolumeAuthorings,
799
+ v => v.zone != null && v.zone.id.Equals(landing.landingZone.id)).ToList();
800
+
801
+ if (landingVolumes.Count == 0) continue;
702
802
 
703
- // Find the landing zone volume
704
- foreach (var volumeAuth in allVolumeAuthorings)
803
+ var landingCenter = CalculateZoneCenter(landingVolumes);
804
+
805
+ // Draw landing zone volumes in blue
806
+ foreach (var volume in landingVolumes)
705
807
  {
706
- if (volumeAuth == null || volumeAuth.zone == null) continue;
707
-
708
- if (volumeAuth.zone.id.Equals(landing.landingZone.id))
709
- {
710
- var landingPos = volumeAuth.transform.position;
711
- var landingScale = volumeAuth.transform.localScale;
712
-
713
- // Draw ACTUAL connection from landing zone to current volume (yellow solid line)
714
- Handles.color = Color.yellow;
715
- Handles.DrawLine(landingPos, selectedPos);
716
- break;
717
- }
808
+ Handles.color = Color.blue;
809
+ Handles.DrawWireCube(volume.transform.position, volume.transform.localScale);
718
810
  }
811
+
812
+ // Draw connection
813
+ Handles.color = Color.yellow;
814
+ Handles.DrawLine(landingCenter, selectedZoneCenter);
719
815
  }
720
816
 
721
817
  // Priority 2: Draw landing zones - blue boxes, same size as volume
@@ -724,34 +820,51 @@ namespace jeanf.scenemanagement
724
820
  if (landing.landingZone == null || landing.region == null) continue;
725
821
  if (landing.landingZone == currentZone) continue; // Skip self (will be drawn as selected)
726
822
 
727
- // Find the landing zone volume
728
- foreach (var volumeAuth in allVolumeAuthorings)
823
+ // Find all landing zone volumes
824
+ var landingVolumes = System.Array.FindAll(allVolumeAuthorings,
825
+ v => v.zone != null && v.zone.id.Equals(landing.landingZone.id)).ToList();
826
+
827
+ if (landingVolumes.Count == 0) continue;
828
+
829
+ // Draw landing zone volumes in blue, same size as volume
830
+ foreach (var landingVolume in landingVolumes)
729
831
  {
730
- if (volumeAuth == null || volumeAuth.zone == null) continue;
832
+ var landingPos = landingVolume.transform.position;
833
+ var landingScale = landingVolume.transform.localScale;
731
834
 
732
- if (volumeAuth.zone.id.Equals(landing.landingZone.id))
733
- {
734
- var landingPos = volumeAuth.transform.position;
735
- var landingScale = volumeAuth.transform.localScale;
736
-
737
- // Draw landing zone in blue, same size as volume
738
- Handles.color = Color.blue;
739
- Handles.DrawWireCube(landingPos, landingScale);
740
- break;
741
- }
835
+ Handles.color = Color.blue;
836
+ Handles.DrawWireCube(landingPos, landingScale);
742
837
  }
743
838
  }
744
839
 
745
- // Priority 1: Draw selected volume last - yellow box, actual size
746
- Handles.color = Color.yellow;
747
- Handles.DrawWireCube(selectedPos, selectedScale);
748
- Handles.Label(selectedPos + Vector3.up * (selectedScale.y * 0.7f),
749
- $"SELECTED\n{currentZone.zoneName}",
840
+ // Priority 1: Draw selected zone volumes last - yellow boxes, actual size
841
+ foreach (var selectedVol in selectedZoneVolumes)
842
+ {
843
+ Handles.color = Color.yellow;
844
+ Handles.DrawWireCube(selectedVol.transform.position, selectedVol.transform.localScale);
845
+ }
846
+
847
+ // Add label for the selected zone at the zone center
848
+ Handles.Label(selectedZoneCenter + Vector3.up * 2f,
849
+ $"SELECTED ZONE\n{currentZone.zoneName}\n({selectedZoneVolumes.Count} volumes)",
750
850
  new GUIStyle(GUI.skin.label) {
751
851
  normal = { textColor = Color.yellow },
752
852
  fontStyle = FontStyle.Bold
753
853
  });
754
854
  }
855
+
856
+ private Vector3 CalculateZoneCenter(List<VolumeAuthoring> volumes)
857
+ {
858
+ if (volumes.Count == 0) return Vector3.zero;
859
+ if (volumes.Count == 1) return volumes[0].transform.position;
860
+
861
+ Vector3 sum = Vector3.zero;
862
+ foreach (var volume in volumes)
863
+ {
864
+ sum += volume.transform.position;
865
+ }
866
+ return sum / volumes.Count;
867
+ }
755
868
  }
756
869
 
757
870
  [CustomPropertyDrawer(typeof(LandingZoneData))]
@@ -79,7 +79,6 @@ namespace jeanf.scenemanagement
79
79
  _toLoadList.Clear();
80
80
  _toUnloadList.Clear();
81
81
 
82
- // GC ALLOCATION FIX: Use try-finally for guaranteed disposal
83
82
  var relevantPositions = _relevantQuery.ToComponentDataArray<LocalToWorld>(Allocator.TempJob);
84
83
  try
85
84
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fr.jeanf.scenemanagement",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "displayName": "Scene Management",
5
5
  "description": "This package contains two scene loading system, one is additive, the other is to load subscenes. \nBoth system are living side-by-side.\nThe dynamic systems handles the loading of all static content (environment) using subscenes.\nThe additive system loads scene additively depending on zone & region and upon scenario load/unload requests. Each region or scenario can have dependency that will remain loaded until either a region or a scenario became irrelevant.",
6
6
  "unity": "2021.3",