Added Furnance and smelting

This commit is contained in:
2026-08-11 17:12:34 +03:00
parent 2a30d4d8cf
commit 67e0bcfaaf
82 changed files with 25148 additions and 7186 deletions
@@ -1,9 +1,14 @@
using System.Collections.Generic;
using UnityEngine;
public interface IGlobalUISectionController { }
public sealed class GlobalUIController : MonoBehaviour
{
public static GlobalUIController Instance { get; private set; }
private readonly HashSet<IGlobalUISectionController> sectionControllers = new();
private void Awake()
{
if (Instance != null && Instance != this)
@@ -13,11 +18,43 @@ public sealed class GlobalUIController : MonoBehaviour
}
Instance = this;
foreach (MonoBehaviour behaviour in FindObjectsByType<MonoBehaviour>(
FindObjectsInactive.Include,
FindObjectsSortMode.None))
{
if (behaviour is IGlobalUISectionController controller)
Register(controller);
}
}
public void Register(IGlobalUISectionController controller)
{
if (controller != null)
sectionControllers.Add(controller);
}
public void Unregister(IGlobalUISectionController controller)
{
if (controller != null)
sectionControllers.Remove(controller);
}
public IEnumerable<T> GetControllers<T>() where T : class, IGlobalUISectionController
{
foreach (IGlobalUISectionController controller in sectionControllers)
{
if (controller is T typedController)
yield return typedController;
}
}
private void OnDestroy()
{
if (Instance == this)
{
sectionControllers.Clear();
Instance = null;
}
}
}