public BuilderViewModel(Map map) { Model = new Builder(); View = new BuilderView(); _map = map; _nearestPillars = new NearestPillars(_map); }
private void RouteRewalk(Builder model, BuilderView view, int maxIndex) { for (int i = 0; i <= maxIndex; i++) { ColoredPillar oldStep = view.RouteReWalk(model.Path.GetByIndex(i)); SetInCurrentFrame(oldStep, "REWALK"); } }
/// <summary> /// Generate a collection of <see cref="BoardFrame"/> /// to display it on the <see cref="Console"/>. /// </summary> /// <param name="model">Object with a Path property.</param> /// <param name="view">View for the model.</param> public void GenerateFrames(Builder model, BuilderView view) { for (int i = 0; i < model.Path.Length - 1; i++) { ColoredPillar newStep = view.NewStep(model.Path.GetByIndex(i)); SetInCurrentFrame(newStep, "STEP"); SwitchToNextFrame(); RouteRewalk(model, view, i); } if (0 < model.Path.Length) { ColoredPillar position = view.Build(_map.GetField(model.Path.Last())); SetInCurrentFrame(position, "BUILD"); } }