//Code for Time Is Dragging Delivery. private IEnumerator TimeIsDragging() { AudioManager.instance.PlaySound(AudioManager.SoundType.TIME_IS_DRAGGING); float playerSpeedChange = Random.Range(1f, 2f); float pizzaSpawnTimerChange = Random.Range(0.5f, 1.5f); float customerSpeedChange = Random.Range(0.2f, 0.5f); //Slow pizza spawn down SpawnManager.instance.ChangePizzaSpawnTimer(pizzaSpawnTimerChange); //Slow customer speed foreach (GameObject obj in SpawnManager.instance.CustomerList) { HungryCustomerMovement script = obj.GetComponent <HungryCustomerMovement>(); script.IncreaseMovementSpeed(-customerSpeedChange); } //Slow player speed PlayerMovement.instance.ChangeMovementSpeed(-playerSpeedChange); yield return(new WaitForSeconds(ActiveTime)); SpawnManager.instance.DefaultPizzaSpawnTimer(); foreach (GameObject obj in SpawnManager.instance.CustomerList) { HungryCustomerMovement script = obj.GetComponent <HungryCustomerMovement>(); script.SetDefaultSpeed(); } PlayerMovement.instance.SetDefaultSpeed(); UIManager.instance.HideDeliveryIcon(); }
//Code for RushHour Delivery. private IEnumerator RushHour() { AudioManager.instance.PlaySound(AudioManager.SoundType.RUSH_HOUR); float speedChange = Random.Range(0.5f, 1f); foreach (GameObject obj in SpawnManager.instance.CustomerList) { HungryCustomerMovement script = obj.GetComponent <HungryCustomerMovement>(); script.IncreaseMovementSpeed(speedChange); } yield return(new WaitForSeconds(ActiveTime)); foreach (GameObject obj in SpawnManager.instance.CustomerList) { HungryCustomerMovement script = obj.GetComponent <HungryCustomerMovement>(); script.SetDefaultSpeed(); } UIManager.instance.HideDeliveryIcon(); }