示例#1
0
文件: Food.cs 项目: aequabit/Snek
        /// <inheritdoc cref="IRenderable.RenderMap"/>
        public RenderMap RenderMap(bool compatibility = false)
        {
            var map = new RenderMap();

            map.Add(_positions[0], compatibility ? 'x' : '●');

            return(map);
        }
示例#2
0
        /// <inheritdoc cref="IRenderable.RenderMap"/>
        public RenderMap RenderMap(bool compatibility = false)
        {
            var map = new RenderMap();

            // Calculate the location of the title bar
            for (var i = 0; i < _text.Length; i++)
            {
                map.Add(new Position(i, 0), _text[i]);
            }
            return(map);
        }
示例#3
0
        /// <inheritdoc cref="IRenderable.RenderMap"/>
        public RenderMap RenderMap(bool compatibility = false)
        {
            var map = new RenderMap();

            // Calculate the location of the status bar
            for (var i = Console.BufferWidth - _text.Length - 1; i < Console.BufferWidth - 1; i++)
            {
                map.Add(new Position(i, Console.BufferHeight - 1), _text[i - Console.BufferWidth + _text.Length + 1]);
            }

            return(map);
        }
示例#4
0
文件: Snake.cs 项目: aequabit/Snek
        /// <inheritdoc cref="IRenderable.RenderMap"/>
        public RenderMap RenderMap(bool compatibility = false)
        {
            var map = new RenderMap();

            foreach (var position in _positions)
            {
                map.Add(position, compatibility ? '#' : '█');
            }

// Concept of different heads depending on the moving direction
//            var last = _locations.Last();
//            foreach (var location in _locations)
//            {
//                map.Add(location, compatibility ? '#' : '█');
//                if (location.X == last.X && location.Y == last.Y)
//                    switch (_direction)
//                    {
//                        case Direction.Down:
//                            map.Add(location, '▼');
//                            break;
//                        case Direction.Left:
//                            map.Add(location, '◀');
//                            break;
//                        case Direction.Right:
//                            map.Add(location, '▶');
//                            break;
//                        case Direction.Up:
//                            map.Add(location, '▲');
//                            break;
//                    }
//                else
//                    map.Add(location, '█');
//            }

            return(map);
        }