Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Inspiaaa committed Aug 30, 2023
1 parent 111f1ee commit 73bc304
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/CoroutineBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ public virtual void OnChildStopped(CoroutineBase child)
/// </summary>
public void Kill()
{
if (!isAlive)
{
return;
}

try
{
OnExit();
Expand Down
3 changes: 2 additions & 1 deletion src/Coroutines/Coroutine.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.ComponentModel;

namespace HCoroutines
{
Expand Down Expand Up @@ -46,7 +47,7 @@ public override void Update()
object obj = routine.Current;

// yield return null; => do nothing.
if (obj == null)
if (obj is null)
{
return;
}
Expand Down
10 changes: 9 additions & 1 deletion src/Util/TimeScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@ public int ScheduleOnSignal(Action action, Godot.Object obj, string signal)
{
int id = GetNextScheduleId();
actionsById[id] = action;
obj.Connect(signal, this, "CallCallback", new Godot.Collections.Array(id), (int)ConnectFlags.Oneshot);

obj.Connect(
signal,
this,
nameof(CallCallback),
new Godot.Collections.Array(id),
(int)ConnectFlags.Oneshot
);

return id;
}

Expand Down

0 comments on commit 73bc304

Please sign in to comment.