diff --git a/Coroutine/CoroutineHandlerInstance.cs b/Coroutine/CoroutineHandlerInstance.cs index 3c77dc1..7bcc2bf 100644 --- a/Coroutine/CoroutineHandlerInstance.cs +++ b/Coroutine/CoroutineHandlerInstance.cs @@ -13,7 +13,7 @@ namespace Coroutine { private readonly List tickingCoroutines = new List(); private readonly List eventCoroutines = new List(); private readonly Queue outstandingCoroutines = new Queue(); - private readonly Dictionary deletedCoroutinesIndexes = new Dictionary(); + private readonly Dictionary eventcoroutinesIndexesToDelete = new Dictionary(); private readonly Stopwatch stopwatch = new Stopwatch(); /// @@ -69,7 +69,7 @@ namespace Coroutine { /// /// The amount of seconds that have passed since the last time this method was invoked public void Tick(double deltaSeconds) { - this.RemoveDeletedCoroutines(); + this.removeEventCoroutines(); this.AddOutstandingCoroutines(); this.tickingCoroutines.RemoveAll(c => { if (c.Tick(deltaSeconds)) { @@ -87,13 +87,13 @@ namespace Coroutine { /// /// The event to raise public void RaiseEvent(Event evt) { - for (int i = 0; i < this.eventCoroutines.Count; i++) { + for (var i = 0; i < this.eventCoroutines.Count; i++) { var eventCoroutine = this.eventCoroutines[i]; if (eventCoroutine.OnEvent(evt)) { - this.deletedCoroutinesIndexes[i] = 1; + this.eventcoroutinesIndexesToDelete[i] = 1; } else if (!eventCoroutine.IsWaitingForEvent()) { this.outstandingCoroutines.Enqueue(eventCoroutine); - this.deletedCoroutinesIndexes[i] = 1; + this.eventcoroutinesIndexesToDelete[i] = 1; } } } @@ -115,13 +115,13 @@ namespace Coroutine { } } - private void RemoveDeletedCoroutines() { + private void removeEventCoroutines() { int counter = 0; this.eventCoroutines.RemoveAll(c => { - return this.deletedCoroutinesIndexes.ContainsKey(counter++); + return this.eventcoroutinesIndexesToDelete.ContainsKey(counter++); }); - this.deletedCoroutinesIndexes.Clear(); + this.eventcoroutinesIndexesToDelete.Clear(); } private static IEnumerator InvokeLaterImpl(Wait wait, Action action) {