Пример #1
0
        /// <summary>
        /// Initializes input manager, rendering engine, game object and so on.
        /// </summary>
        private void Initialize()
        {
            GameScreen = new ConsoleGameScreen();

            InputManager = new InputManager();
            InputManager.AddInputDevice(new KeyboardInputDevice());

            Snake = new Snake(Direction.Down, new []{new Coord(10,10), new Coord(10,11), new Coord(10,12)});
            SnakeView = new SnakeView(Snake);

            Apple = Apple.Create(GenerateRandomCoordinate(Snake.Body));
            AppleView = new AppleView(Apple);

            RenderingEngine = new RenderingEngine();
            RenderingEngine.AddView(AppleView);
            RenderingEngine.AddView(SnakeView);
            

            GameTimer = new Stopwatch();
        }
Пример #2
0
 /// <summary>
 /// Initializes the view
 /// </summary>
 /// <param name="snake"></param>
 public SnakeView(Snake snake)
 {
     Snake = snake;
 }