所以我有一个变量 isMoving,当协程结束时它应该变成 false。比如:
if (m_IsMoving == false){
m_IsMoving = true;
StartCoroutine(time_passed.Tweeng((time_Set_Movement) =>
transform.position = time_Set_Movement,
transform.position,
new Vector3(transform.position.x + positior.x,
transform.position.y + positior.y, transform.position.z + positior.z) );
// I am searching for some way to continue the coroutine with
then{ m_IsMoving = false;}
}
有没有一种简单的方法可以在协程结束后添加类似的内容?
最简单的选择是更改协程内的值。有点喜欢
private _someBool = false;
private void SomeMethod()
{
StartCoroutine(CoSomeCoroutine());
}
private IEnumeratoe CoSomeCoroutine()
{
_someBool = true;
// do your stuff here
_someBool = false;
}