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
|
|
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
|
|
129
|
-
|
|
129
|
+
// Draw all volumes for this region
|
|
130
|
+
foreach (var volume in volumes)
|
|
130
131
|
{
|
|
131
|
-
|
|
132
|
-
if (currentVolume == null) continue;
|
|
132
|
+
if (volume == null) continue;
|
|
133
133
|
|
|
134
|
-
var
|
|
135
|
-
var
|
|
134
|
+
var pos = volume.transform.position;
|
|
135
|
+
var scale = volume.transform.localScale;
|
|
136
136
|
|
|
137
137
|
Handles.color = color;
|
|
138
|
-
Handles.DrawWireCube(
|
|
138
|
+
Handles.DrawWireCube(pos, scale);
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
// Draw connections between
|
|
142
|
-
|
|
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
|
-
|
|
145
|
-
if (currentVolume == null) continue;
|
|
145
|
+
if (volume?.zone == null) continue;
|
|
146
146
|
|
|
147
|
-
var
|
|
147
|
+
var zoneId = volume.zone.id.ToString();
|
|
148
|
+
if (!zoneVolumeGroups.ContainsKey(zoneId))
|
|
149
|
+
zoneVolumeGroups[zoneId] = new List<VolumeAuthoring>();
|
|
148
150
|
|
|
149
|
-
|
|
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
|
|
152
|
-
|
|
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(
|
|
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
|
-
|
|
167
|
-
|
|
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 (
|
|
181
|
+
if (landingVolumes.Count == 0) continue;
|
|
170
182
|
|
|
171
|
-
var
|
|
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
|
-
|
|
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
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
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
|
-
|
|
198
|
-
|
|
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 (
|
|
216
|
+
if (landingVolumes.Count == 0) continue;
|
|
201
217
|
|
|
202
|
-
|
|
203
|
-
var
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
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
|
-
|
|
218
|
-
|
|
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
|
-
|
|
256
|
+
var landingCenter = CalculateZoneCenter(landingVolumes);
|
|
221
257
|
|
|
222
|
-
|
|
223
|
-
var
|
|
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.
|
|
226
|
-
|
|
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
|
-
|
|
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
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
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
|
-
|
|
411
|
+
// Draw all volumes in this region
|
|
412
|
+
foreach (var volume in volumes)
|
|
366
413
|
{
|
|
367
|
-
|
|
368
|
-
if (currentVolume == null) continue;
|
|
414
|
+
if (volume == null) continue;
|
|
369
415
|
|
|
370
|
-
var currentPos =
|
|
371
|
-
var currentScale =
|
|
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
|
-
|
|
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
|
-
|
|
381
|
-
|
|
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
|
-
|
|
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
|
-
|
|
399
|
-
|
|
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
|
-
|
|
488
|
+
var landingCenter = CalculateZoneCenter(landingVolumes);
|
|
402
489
|
|
|
403
|
-
|
|
404
|
-
var
|
|
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.
|
|
407
|
-
|
|
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
|
-
|
|
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
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
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
|
-
|
|
627
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
//
|
|
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
|
|
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;
|
|
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
|
-
|
|
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 (
|
|
677
|
-
|
|
678
|
-
if (volumeAuth.zone.id.Equals(zone.id))
|
|
775
|
+
if (!_regionColors.ContainsKey(region))
|
|
679
776
|
{
|
|
680
|
-
var
|
|
681
|
-
|
|
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
|
-
//
|
|
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;
|
|
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
|
-
|
|
704
|
-
|
|
803
|
+
var landingCenter = CalculateZoneCenter(landingVolumes);
|
|
804
|
+
|
|
805
|
+
// Draw landing zone volumes in blue
|
|
806
|
+
foreach (var volume in landingVolumes)
|
|
705
807
|
{
|
|
706
|
-
|
|
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
|
|
728
|
-
|
|
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
|
-
|
|
832
|
+
var landingPos = landingVolume.transform.position;
|
|
833
|
+
var landingScale = landingVolume.transform.localScale;
|
|
731
834
|
|
|
732
|
-
|
|
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
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
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))]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fr.jeanf.scenemanagement",
|
|
3
|
-
"version": "0.3.
|
|
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",
|