public Engine() { this.objects = new List <EnvironmentObject>(); this.consoleRenderer = new ConsoleRenderer(WorldWidth, WorldHeight); this.objectGenerator = new ObjectGenerator(WorldWidth, WorldHeight); this.worldBounds = new Rectangle(0, 0, WorldWidth, WorldHeight); CollisionHandler.Initlialize(WorldWidth, WorldHeight); }
public static void Main() { var objectGenerator = new ObjectGenerator(WorldWidth, WorldHeight); var consoleRenderer = new ConsoleRenderer(WorldWidth, WorldHeight); var collisionHandler = new CollisionHandler(WorldWidth, WorldHeight); var engine = new EngineExtender(WorldWidth, WorldHeight, objectGenerator, collisionHandler, consoleRenderer); engine.Run(); }
static void Main() { var objectGenerator = new ObjectGenerator(WorldWidth, WorldHeight); var consoleRenderer = new ConsoleRenderer(WorldWidth, WorldHeight); var collisionHandler = new CollisionHandler(WorldWidth, WorldHeight); var keyboardController = new KeyboardController(); var engine = new AdvancedEngine(keyboardController, WorldWidth, WorldHeight, objectGenerator, collisionHandler, consoleRenderer); engine.Run(); }
protected virtual void ExecuteEnvironmentLoop() { this.objectGenerator.DynamicallyAdd(this.objects); for (int i = 0; i < this.objects.Count; i++) { this.objects[i].Update(); } CollisionHandler.HandleCollisions(this.objects); this.ProcessObjectProduction(); this.objects.RemoveAll(x => !x.Exists); this.objects.RemoveAll(x => !Rectangle.Intersects(this.worldBounds, x.Bounds)); for (int i = 0; i < this.objects.Count; i++) { this.consoleRenderer.EnqueueForRendering(objects[i]); } this.consoleRenderer.RenderAll(); Thread.Sleep(LoopIntervalInMilliseconds); this.consoleRenderer.ClearQueue(); }