Hey!
For some reason when I put yield return new WaitForSeconds inside boolean it coroutine just ignored it.
These are parts of script I’m working on.
private void InitFinal (int i) {
if (spells *.isCast) {*
_ if (!UIManager.instance.castBar.gameObject.activeSelf && spells .castCounter <= 0) {_
_ spells .casting = true;
if (spells .castDone) {
spells .UseResource (transform.GetComponent ());
spells .Wait ();
spells .Init ();
spells .InitEffect ();
spells .castDone = false;
* }
}
else {
if (Input.anyKeyDown) {
StartCoroutine (MessageText.instance.ShowMessage (“Action is in progress.”, 2, Color.red));
}
}
}
else {
spells .UseResource (transform.GetComponent ());
spells .Wait ();
spells .Init ();
spells .InitEffect ();
}
}*_
* private IEnumerator InitFinalRanged (int i) {*
_ if (spells .isCast) {
* if (!UIManager.instance.castBar.gameObject.activeSelf) {*
spells .casting = true;
if (spells .castDone) {
spells .InitEffect ();
spells .UseResource (transform.GetComponent ());
spells .Wait ();_
_ float time = distance / spells .effect.GetComponent ().moveSpeed;
* yield return new WaitForSeconds (time);*_
_ spells .Init ();
* }
}
else {
if (Input.anyKeyDown) {
StartCoroutine (MessageText.instance.ShowMessage (“Action is in progress.”, 2, Color.red));
}
}
}
else {*
spells .InitEffect ();
spells .UseResource (transform.GetComponent ());
spells .Wait ();_
_ float time = distance / spells .effect.GetComponent ().moveSpeed;
* yield return new WaitForSeconds (time);*_
_ spells .Init ();
* }
}*
When I toggle isCast, InitFinalRanged coroutine just ignores that yield, but works perfectly when isCast = false.
Any ideas? Thanks!_