copy from github

This commit is contained in:
Sebastian Bularca
2026-03-27 15:13:27 +01:00
parent 83532f396d
commit 823e146df0
44 changed files with 2999 additions and 2 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);
}
}
}
}