This commit is contained in:
ohgushiyuga
2026-08-27 12:51:15 +09:00
parent 1441c96f74
commit 52341100ed
32 changed files with 840 additions and 1076 deletions

View File

@@ -0,0 +1,47 @@
using System.Collections.Generic;
using UnityEngine;
public class WorldPauseManager : MonoBehaviour
{
public static WorldPauseManager Instance { get; private set; }
private readonly HashSet<IPauseable> pauseables = new HashSet<IPauseable>();
private void Awake()
{
if (Instance == null)
{
Instance = this;
}
else
{
Destroy(gameObject);
}
}
public void Register(IPauseable pauseable)
{
if (pauseable != null) pauseables.Add(pauseable);
}
public void Unregister(IPauseable pauseable)
{
if (pauseable != null) pauseables.Remove(pauseable);
}
public void PauseWorld()
{
foreach (var p in pauseables)
{
p?.Pause();
}
}
public void ResumeWorld()
{
foreach (var p in pauseables)
{
p?.Resume();
}
}
}