2025-03-31 11:49:53 +08:00
|
|
|
|
using System.Collections;
|
2025-03-06 17:24:31 +08:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.Internal;
|
|
|
|
|
|
|
2025-03-31 11:49:53 +08:00
|
|
|
|
namespace Stary.Evo.AudioCore
|
2025-03-26 09:34:52 +08:00
|
|
|
|
{
|
|
|
|
|
|
public static class CoroutineHelper
|
2025-03-06 17:24:31 +08:00
|
|
|
|
{
|
2025-03-26 09:34:52 +08:00
|
|
|
|
private static CoroutineRunner coroutineRunner;
|
2025-03-06 17:24:31 +08:00
|
|
|
|
|
2025-03-26 09:34:52 +08:00
|
|
|
|
public static void SetRunner()
|
|
|
|
|
|
{
|
|
|
|
|
|
GameObject runnerObject = new GameObject("CoroutineRunner");
|
|
|
|
|
|
coroutineRunner = runnerObject.AddComponent<CoroutineRunner>();
|
|
|
|
|
|
}
|
|
|
|
|
|
public static Coroutine StartCoroutine(IEnumerator coroutine)
|
|
|
|
|
|
{
|
|
|
|
|
|
Coroutine myCoroutine = coroutineRunner.StartCoroutine(coroutine);
|
|
|
|
|
|
return myCoroutine;
|
|
|
|
|
|
}
|
|
|
|
|
|
public static void StopCoroutine(Coroutine myCoroutine)
|
|
|
|
|
|
{
|
|
|
|
|
|
coroutineRunner.StopCoroutine(myCoroutine);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private class CoroutineRunner : MonoBehaviour { }
|
|
|
|
|
|
}
|
2025-03-06 17:24:31 +08:00
|
|
|
|
}
|