Warning texts when water pressure is increasing to dangerous levels and when running out of oxygen, added a method for invoking an arbitrary action after a delay to CoroutineManager
This commit is contained in:
@@ -37,6 +37,26 @@ namespace Barotrauma
|
||||
return handle;
|
||||
}
|
||||
|
||||
public static void InvokeAfter(Action action, float delay)
|
||||
{
|
||||
StartCoroutine(DoInvokeAfter(action, delay));
|
||||
}
|
||||
|
||||
private static IEnumerable<object> DoInvokeAfter(Action action, float delay)
|
||||
{
|
||||
if (action == null)
|
||||
{
|
||||
yield return CoroutineStatus.Failure;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(delay);
|
||||
|
||||
action();
|
||||
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
|
||||
public static bool IsCoroutineRunning(string name)
|
||||
{
|
||||
return Coroutines.Any(c => c.Name == name);
|
||||
|
||||
Reference in New Issue
Block a user