Ejemplo n.º 1
0
        /// <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);
                }
            }
        }
Ejemplo n.º 2
0
        /// <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;
        }
Ejemplo n.º 3
0
 public void Step(Pillar position)
 {
     Path.Increase(position);
 }
Ejemplo n.º 4
0
 public void SetField(Pillar position)
 {
     _map[position.Y, position.X] = position;
 }
Ejemplo n.º 5
0
 /// <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));
 }
Ejemplo n.º 6
0
 public static ColoredPillar Parse(Pillar pillar)
 {
     return(new ColoredPillar(pillar.X, pillar.Y, pillar.Height, ConsoleColor.White, ConsoleColor.Black));
 }