mirror of
https://github.com/Ellpeck/Coroutine.git
synced 2024-12-22 09:09:23 +01:00
allow invoking later with an event directly
This commit is contained in:
parent
201369f167
commit
dc5206fced
2 changed files with 20 additions and 1 deletions
|
@ -25,15 +25,21 @@ namespace Coroutine {
|
|||
return CoroutineHandler.Instance.Start(coroutine, name, priority);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="CoroutineHandlerInstance.InvokeLater"/>
|
||||
/// <inheritdoc cref="CoroutineHandlerInstance.InvokeLater(Wait,Action,string,int)"/>
|
||||
public static ActiveCoroutine InvokeLater(Wait wait, Action action, string name = "", int priority = 0) {
|
||||
return CoroutineHandler.Instance.InvokeLater(wait, action, name, priority);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="CoroutineHandlerInstance.InvokeLater(Event,Action,string,int)"/>
|
||||
public static ActiveCoroutine InvokeLater(Event evt, Action action, string name = "", int priority = 0) {
|
||||
return CoroutineHandler.Instance.InvokeLater(evt, action, name, priority);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="CoroutineHandlerInstance.Tick(double)"/>
|
||||
public static void Tick(double deltaSeconds) {
|
||||
CoroutineHandler.Instance.Tick(deltaSeconds);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="CoroutineHandlerInstance.Tick(TimeSpan)"/>
|
||||
public static void Tick(TimeSpan delta) {
|
||||
CoroutineHandler.Instance.Tick(delta);
|
||||
|
|
|
@ -78,6 +78,19 @@ namespace Coroutine {
|
|||
return this.Start(CoroutineHandlerInstance.InvokeLaterImpl(wait, action), name, priority);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Causes the given action to be invoked after the given <see cref="Event"/>.
|
||||
/// This is equivalent to a coroutine that waits for the given wait and then executes the given <see cref="Action"/>.
|
||||
/// </summary>
|
||||
/// <param name="evt">The event to wait for</param>
|
||||
/// <param name="action">The action to execute after waiting</param>
|
||||
/// <param name="name">The <see cref="ActiveCoroutine.Name"/> that the underlying coroutine should have. Defaults to an empty string.</param>
|
||||
/// <param name="priority">The <see cref="ActiveCoroutine.Priority"/> that the underlying coroutine should have. The higher the priority, the earlier it is advanced compared to other coroutines that advance around the same time. Defaults to 0.</param>
|
||||
/// <returns>An active coroutine object representing this coroutine</returns>
|
||||
public ActiveCoroutine InvokeLater(Event evt, Action action, string name = "", int priority = 0) {
|
||||
return this.InvokeLater(new Wait(evt), action, name, priority);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ticks this coroutine handler, causing all time-based <see cref="Wait"/>s to be ticked.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in a new issue