private IEnumerator SlowDownCoroutine(float time, float percent, AbstractBug bug) { bug.coroutineRunning.Add(true); bug.speed = bug.startSpeed * (1f - percent); yield return(new WaitForSeconds(time)); bug.coroutineRunning.Add(false); if (bug.IsSlowedDown() == false) { bug.RestoreSpeed(); } }
private void SlowDown(float time, float percent, AbstractBug bug) { StartCoroutine(SlowDownCoroutine(time, percent, bug)); }