Пример #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);
                }
            }
        }
Пример #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;
        }
Пример #3
0
 public void Step(Pillar position)
 {
     Path.Increase(position);
 }
Пример #4
0
 public void SetField(Pillar position)
 {
     _map[position.Y, position.X] = position;
 }
Пример #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));
 }
Пример #6
0
 public static ColoredPillar Parse(Pillar pillar)
 {
     return(new ColoredPillar(pillar.X, pillar.Y, pillar.Height, ConsoleColor.White, ConsoleColor.Black));
 }