mirror of
https://github.com/Ellpeck/Coroutine.git
synced 2024-11-22 05:43:29 +01:00
name changes
This commit is contained in:
parent
3998cd92d7
commit
469527cd87
1 changed files with 8 additions and 8 deletions
|
@ -13,7 +13,7 @@ namespace Coroutine {
|
||||||
private readonly List<ActiveCoroutine> tickingCoroutines = new List<ActiveCoroutine>();
|
private readonly List<ActiveCoroutine> tickingCoroutines = new List<ActiveCoroutine>();
|
||||||
private readonly List<ActiveCoroutine> eventCoroutines = new List<ActiveCoroutine>();
|
private readonly List<ActiveCoroutine> eventCoroutines = new List<ActiveCoroutine>();
|
||||||
private readonly Queue<ActiveCoroutine> outstandingCoroutines = new Queue<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();
|
private readonly Stopwatch stopwatch = new Stopwatch();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -69,7 +69,7 @@ namespace Coroutine {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="deltaSeconds">The amount of seconds that have passed since the last time this method was invoked</param>
|
/// <param name="deltaSeconds">The amount of seconds that have passed since the last time this method was invoked</param>
|
||||||
public void Tick(double deltaSeconds) {
|
public void Tick(double deltaSeconds) {
|
||||||
this.RemoveDeletedCoroutines();
|
this.removeEventCoroutines();
|
||||||
this.AddOutstandingCoroutines();
|
this.AddOutstandingCoroutines();
|
||||||
this.tickingCoroutines.RemoveAll(c => {
|
this.tickingCoroutines.RemoveAll(c => {
|
||||||
if (c.Tick(deltaSeconds)) {
|
if (c.Tick(deltaSeconds)) {
|
||||||
|
@ -87,13 +87,13 @@ namespace Coroutine {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="evt">The event to raise</param>
|
/// <param name="evt">The event to raise</param>
|
||||||
public void RaiseEvent(Event evt) {
|
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];
|
var eventCoroutine = this.eventCoroutines[i];
|
||||||
if (eventCoroutine.OnEvent(evt)) {
|
if (eventCoroutine.OnEvent(evt)) {
|
||||||
this.deletedCoroutinesIndexes[i] = 1;
|
this.eventcoroutinesIndexesToDelete[i] = 1;
|
||||||
} else if (!eventCoroutine.IsWaitingForEvent()) {
|
} else if (!eventCoroutine.IsWaitingForEvent()) {
|
||||||
this.outstandingCoroutines.Enqueue(eventCoroutine);
|
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;
|
int counter = 0;
|
||||||
this.eventCoroutines.RemoveAll(c => {
|
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) {
|
private static IEnumerator<Wait> InvokeLaterImpl(Wait wait, Action action) {
|
||||||
|
|
Loading…
Reference in a new issue