protected static void ResetPosture(Sim sim) { if (sim.Posture != null) { int count = 0; Posture posture = sim.Posture; while ((posture != null) && (count < 5)) { try { posture.OnReset(sim); } catch (Exception e) { Common.Exception(sim, e); } count++; posture = posture.PreviousPosture; } if (posture != null) { posture.PreviousPosture = null; } try { sim.Posture = null; } catch (Exception e) { Common.Exception(sim, e); sim.mPosture = null; } } }