Merge 5ed16bc338
into b46a42b689
This commit is contained in:
commit
14d4686477
|
@ -73,6 +73,17 @@ namespace Godot
|
|||
_delegate = @delegate;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new <see cref="Callable"/> for the given <paramref name="callback"/>.
|
||||
/// </summary>
|
||||
/// <param name="callback">Action method that will be called.</param>
|
||||
public Callable(Action callback)
|
||||
{
|
||||
_target = null;
|
||||
_method = null;
|
||||
_delegate = callback;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls the method represented by this <see cref="Callable"/>.
|
||||
/// Arguments can be passed and should match the method's signature.
|
||||
|
|
|
@ -132,6 +132,22 @@ namespace Godot
|
|||
return new SignalAwaiter(source, signal, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calls the specified <see cref="Action"/> during idle time. Example:
|
||||
/// <code>
|
||||
/// public override void _Process(float delta)
|
||||
/// {
|
||||
/// var collisionShape = GetNode<CollisionShape2D>("CollisionShape2D");
|
||||
/// Defer(() => collisionShape.Disabled = true);
|
||||
/// }
|
||||
/// </code>
|
||||
/// </summary>
|
||||
/// <param name="callback">Callback to call during idle time.</param>
|
||||
protected void Defer(Action callback)
|
||||
{
|
||||
new Callable(callback).CallDeferred();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a new <see cref="DynamicGodotObject"/> associated with this instance.
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in a new issue