void OnBecameInvisible() { ChangeState(new EndPlayerState()); if (gui != null) { gui.ShowEndPanel(); } }