name changes

This commit is contained in:
Zaafar 2021-03-19 19:55:32 -04:00
parent 3998cd92d7
commit 469527cd87
1 changed files with 8 additions and 8 deletions

View File

@ -13,7 +13,7 @@ namespace Coroutine {
private readonly List<ActiveCoroutine> tickingCoroutines = new List<ActiveCoroutine>();
private readonly List<ActiveCoroutine> eventCoroutines = new List<ActiveCoroutine>();
private readonly Queue<ActiveCoroutine> outstandingCoroutines = new Queue<ActiveCoroutine>();
private readonly Dictionary<int, byte> deletedCoroutinesIndexes = new Dictionary<int, byte>();
private readonly Dictionary<int, byte> eventcoroutinesIndexesToDelete = new Dictionary<int, byte>();
private readonly Stopwatch stopwatch = new Stopwatch();
/// <summary>
@ -69,7 +69,7 @@ namespace Coroutine {
/// </summary>
/// <param name="deltaSeconds">The amount of seconds that have passed since the last time this method was invoked</param>
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 {
/// </summary>
/// <param name="evt">The event to raise</param>
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<Wait> InvokeLaterImpl(Wait wait, Action action) {