IEnumerator RespawnNPCTimer(Pedestrian _pedestrian) { Debug.Log("Wait"); yield return(new WaitForSeconds(5)); Debug.Log("Done with wait"); _pedestrian.transform.position = _pedestrian.GetRandomExit().transform.position; _pedestrian.gameObject.SetActive(true); }
public void CycleNPC(Pedestrian _pedestrian) { _pedestrian.gameObject.SetActive(false); _pedestrian._checkedTargets?.Clear(); _pedestrian._customerOrder?.Clear(); var previousExit = _pedestrian._target; var newExit = _pedestrian.GetRandomExit(); if (newExit != previousExit) { _pedestrian._target = newExit; _pedestrian._exitTarget = _pedestrian._target; } else { _pedestrian._target = _pedestrian.GetRandomExit(); } StartCoroutine(RespawnNPCTimer(_pedestrian)); }