Beispiel #1
0
        public static Game StartNewGame(ASCIIMap map, double fov)
        {
            var game = new Game(map, fov);

            game._gameLoop.Start();
            return(game);
        }
Beispiel #2
0
        private static void Main()
        {
            var mapLines = new[]
            {
                "xxxxxxxxxxxxxxxxxxxx",
                "x y                x",
                "x    y        y    x",
                "x y                x",
                "x      zzzzz       x",
                "x   y  z   z       x",
                "x      z   z       x",
                "x  y   zz zz   x   x",
                "x      y           x",
                "x            y     x",
                "x      y     y     x",
                "xxxxxxxxxxxxxxxxxxxx"
            };

            var mapConfig = new MapConfig
            {
                EmptyChar  = ' ',
                PlayerChar = 'p'
            };
            var fov  = 90;
            var game = Game.StartNewGame(ASCIIMap.FromLines(mapConfig, mapLines), fov);
        }
Beispiel #3
0
        public GameLoop(Renderer renderer, ASCIIMap map, double fov)
        {
            _renderer = renderer;
            _map      = map;

            _camera = new Camera(fov)
            {
                PositionVector = new Vector
                {
                    X = (double)map.MapNodes.GetLength(0) / 2, Y = (double)map.MapNodes.GetLength(1) / 2
                }
            };
        }
Beispiel #4
0
        private Game(ASCIIMap map, double fov)
        {
            var renderer = new Renderer(new RendererConfig());

            _gameLoop = new GameLoop(renderer, map, fov);
        }