First commit

This commit is contained in:
sbularca
2026-05-19 15:52:04 +02:00
commit 27b7aeee46
1660 changed files with 240354 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
using System.Collections.Generic;
using UnityEngine;
namespace Jovian.ZoneSystem {
public class ZonesObjectHolder: MonoBehaviour {
internal List<ZoneInstance> Zones { get; } = new();
public MapPlane mapPlane;
public IReadOnlyList<ZoneInstance> AllZones => Zones;
private void Awake() {
Refresh();
}
#if UNITY_EDITOR
private void OnValidate() {
Refresh();
}
#endif
/// <summary>
/// Re-scans the scene for all ZoneInstances and rebuilds their bounds caches.
/// Call this if you add or remove zones at runtime.
/// </summary>
private void Refresh() {
Zones.Clear();
var found = FindObjectsByType<ZoneInstance>(FindObjectsSortMode.None);
foreach(var z in found) {
z.RebuildBoundsCache();
Zones.Add(z);
}
}
}
}