public void OnTick(Graphics gr) { OnDelete?.Invoke(); OnGravity?.Invoke(true); OnSpring?.Invoke(); OnRope?.Invoke(); for (int i = 0; i < Surface.stillColliding.Count; i++) { Surface.stillColliding[i] = false; } do { for (int i = 0; i < Surface.stillColliding.Count; i++) { Surface.stillColliding[i] = false; } OnSurface?.Invoke(); } while (Surface.stillColliding.Contains(true)); OnForceChange?.Invoke(); OnVelChange?.Invoke(dt); OnPosChange?.Invoke(dt); for (int i = -10; i < 10; i++) { gr.DrawLine(Pens.LightGray, i * 60, 0, i * 60, 600); gr.DrawLine(Pens.LightGray, 0, i * 60, 600, i * 60); if (i == 5) { gr.DrawLine(Pens.DarkGray, i * 60, 0, i * 60, 600); gr.DrawLine(Pens.DarkGray, 0, i * 60, 600, i * 60); } } foreach (Body body in bodies) { body.DrawBody(gr); } foreach (Spring spring in springs) { spring.DrawSpring(gr); } foreach (Rope rope in ropes) { rope.DrawRope(gr); } foreach (Surface surface in surfaces) { surface.DrawSurface(gr); } }