- Home /
This question was
closed Dec 15, 2012 at 08:56 AM by
burnpsy for the following reason:
The question is answered, right answer was accepted
StopCoroutine Does Nothing
I have these two coroutines:
IEnumerator SyncTimeDifference () {
while (TwoCharacters) {
SecondsSinceLastSwap++;
while ((SecondsSinceLastSwap > 60) && (SyncPoints != -MaxSP)) {
StartCoroutine(SyncPenalty());
yield return new WaitForSeconds(1.0F);
SecondsSinceLastSwap++;
}
if (SecondsSinceLastSwap < 60) {
StopCoroutine("SyncPenalty");
}
if (SyncPoints == -MaxSP) {
StopCoroutine("SyncPenalty");
}
yield return new WaitForSeconds(1.0F);
}
}
IEnumerator SyncPenalty () {
while (SecondsSinceLastSwap > 60) {
SyncPoints--;
if (SyncPoints == -MaxSP) {
StopCoroutine("SyncPenalty");
}
yield return new WaitForSeconds(1.0F);
}
if (SecondsSinceLastSwap <= 60 || SyncPoints == -MaxSP) {
StopCoroutine("SyncPenalty");
yield return null;
}
}
It's decreasing the variable at the right points, but it isn't stopping the coroutines. At all. What am I doing wrong?
Comment