I don't know what method can let it stop? In this paper, we mainly, the bold tag
For help, thank you,
public float roundIntervalTime=3 f;
Public float spawIntervalTime=1 f;
IEnumerator RunRound ()
{
if (isPause)
{
yield return null;
//is there a way to suspend
}
//SpawnMonsterArgs e=new SpawnMonsterArgs ();
For (int r=0; R & lt; LstRound. Count; R++)
{
//here can join StartRound events, such as triggers the last wave
RoundIndex=r.
For (int I=0; I & lt; LstRound [r]. MonsterCount; I++)
{
//e.m onsterID=lstRound [r]. MonsterID;
//adds (Consts E_SpawnMonster, e);
If (r==(lstRound. Count - 1) & amp; & (I==lstRound [r]. MonsterCount - 1))
{
The Debug Log (" the round is end!" );
}
The else
{
The Debug Log (" Round: r: "+ r +", I: "+ I);
}
Yield return new WaitForSeconds (spawIntervalTime);
}
Yield return new WaitForSeconds (roundIntervalTime);
}
}
Public void StartRound ()
{
coroutine=Game. The Instance. StartCoroutine (RunRound ());
The Debug Log (" RoundModel StartRound () ");
}
Public void StopRound ()
{
//Game. The Instance. StopCoroutine (coroutine);
isPause=! IsPause;
The Debug Log (" isPause: "+ isPause);
}
CodePudding user response:
What is called "suspended"? Einstein to study is looking for?CodePudding user response:
If don't even know how to operate a business to handle, talk programming, must be disorderly speak,Technology is a fart, the key is to do business,
CodePudding user response:
For example, you go to apply for the job, and then the somebody else if you will give you a call to inform you that partial now you say you want to stuck in front of the house, do not know what is called "waiting for the phone call," don't understand the basic life of asynchronous design concept, don't want to entanglements what block concept, so in addition to writing just starting to learn simple mathematical function, also what interactive design "suspended"?CodePudding user response:
AutoResetEvent, ManualReserEventCodePudding user response:
You must set a condition where you want to suspend triggered,,,Otherwise can't control
CodePudding user response:
Want to tell you, but again afraid you hit me, while (true) {if (cond) {break} yield return null; }CodePudding user response:
You can use the Time. The timeScale=0; And Time. The timeScale=1; Conversion to achieve pause and start againCodePudding user response:
That not only rely on coroutines itself, suspended coroutines should be without this function,But in combination with the overall code,
In my code, I control section of the rise and fall of the object, more open and close button,
To do with is coroutines, then use the time. The timeScale=0;
Add while in coroutines (time. The timeScale==0)
{
Yield return null;
}
I do not know what will produce serious consequences, at least, I realized the function first
If someone think that it will leave a hole, please be sure to leave your guidance