IEnumerator DetectFlip() { while (botAlive) { var currentFlip = Vector3.Angle(Vector3.up, transform.up) > 90; if (currentFlip != flipped) { flipped = currentFlip; if (eventChannel != null) { eventChannel.Raise(GameRecord.BotFlipped(gameObject)); } } // wait until next frame; yield return(null); } }