public void Initialize(ISceneSettings settings) { Root = Rules.CreateWorld(this, settings); DrawerFactory = new DrawerFactory(Root); PhysicalManager.InitializeEngine(PhysicalEngines.Farseer, Root); Logger = new ReplayLogger(Root, 0.1); }
public void RunEngine(double timeInSeconds, bool inRealTime) { double dt = 1.0 / 100; int span = (int)(dt * 1000); for (double t = 0; t < timeInSeconds; t += dt) { Logger.LogBodies(); var speeds = RequestedSpeeds.ToArray(); foreach (var e in speeds) { GetBody(e.Key).Velocity = e.Value; } PhysicalManager.MakeIteration(dt, Root); foreach (Body body in Root) { body.Update(1 / 60); } if (inRealTime) { Thread.Sleep(span); } } }
public void Init() { PhysicalManager = new PhysicalManager(); CharacterListener = new CharacterListener(); ItemListener = new ItemListener(); }