I wondered how I can put the speakText-call and the while-loop into a method without starting a new coroutine (I can’t just use a normal method, retruning void, since I return a WaitForSeconds). If this would be C++ the solution would probably be using a macro, but it’s C# and I have no idea where to go. Any suggestions?
and wondered how I could put the following part into a method
I see no reason why you couldn’t call another method that returns an IEnumerator, return the value, and then return that value again in your yield. Never tried it myself. Something like this.
public override IEnumerator onTriggering(){
IEnumerator waitTime = MyMethod();
yield return waitTime;
// Do something interesting
}
private IEnumerator MyMethod(){
// Do something interesting
return new WaitForSeconds(0.5f);
}