Ensure that event coroutines never get duplicated when duplicate events are raised

This commit is contained in:
Ell 2021-03-20 03:23:04 +01:00
parent cf1b3c2db0
commit ff8749a799

View file

@ -97,6 +97,8 @@ namespace Coroutine {
/// <param name="evt">The event to raise</param>
public void RaiseEvent(Event evt) {
for (var i = 0; i < this.eventCoroutines.Count; i++) {
if (this.eventCoroutinesToRemove.Contains(i))
continue;
var c = this.eventCoroutines[i];
if (c.OnEvent(evt)) {
this.eventCoroutinesToRemove.Add(i);