// End game, stop animations, sounds, physics. Finish recording metrics void EndGame() { mcMetric.finishRecording(); var str = metricWriter.GetLogMetrics( DateTime.Now, new List <AbstractMetric>() { mcMetric } ); StartCoroutine(Post("feeder_" + DateTime.Now.ToFileTime() + ".json", str)); dispenser.StopAllCoroutines(); dispenser.screenRed.SetActive(false); dispenser.screenGreen.SetActive(false); dispenser.enabled = false; monster.speed = 0f; foreach (GameObject obj in GameObject.FindGameObjectsWithTag("Food")) { obj.GetComponent <Rigidbody2D>().isKinematic = true; obj.GetComponent <Rigidbody2D>().velocity = Vector2.zero; obj.GetComponent <Rigidbody2D>().angularVelocity = 0f; } foreach (AudioSource aud in FindObjectsOfType(typeof(AudioSource)) as AudioSource[]) { aud.Stop(); } EndLevel(0f); }