/// <summary> /// Initialize a custom size <see cref="Map"/>. /// </summary> /// <param name="width">Should be at least 1.</param> /// <param name="height">Should be at least 1.</param> public Map(int width, int height) { _map = new Pillar[height, width]; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { _map[y, x] = new Pillar(x, y); } } }
/// <summary> /// Increase the <see cref="Path"/> with a new /// <see cref="Pillar"/>. /// </summary> public void Increase(Pillar position) { Pillar[] updated = new Pillar[_fullRoute.Length + 1]; for (int i = 0; i < _fullRoute.Length; i++) { updated[i] = _fullRoute[i]; } updated[_fullRoute.Length] = position; _fullRoute = updated; }
public void Step(Pillar position) { Path.Increase(position); }
public void SetField(Pillar position) { _map[position.Y, position.X] = position; }
/// <summary> /// Get a reference <see cref="Pillar"/> from the <see cref="Map"/> /// </summary> /// <param name="x">Pillar's X coordinate</param> /// <param name="y">Pillar's Y coordinate</param> public Pillar GetField(Pillar position) { return(GetField(position.X, position.Y)); }
public static ColoredPillar Parse(Pillar pillar) { return(new ColoredPillar(pillar.X, pillar.Y, pillar.Height, ConsoleColor.White, ConsoleColor.Black)); }