Exemplo n.º 1
0
        public Controller()
        {
            MainThread = new Thread(new ParameterizedThreadStart(this.GameLoop));
            Drawables = new List<IDrawable>();

            Player = new Player();
            Player.SetPosition(1, 1);
            Drawables.Add(Player);

            ConsoleController = new ConsoleController(this);
            ConsoleController.InitializeConsole();
            ConsoleController.InputRead += ConsoleController_InputRead;
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Map map = CreateMap();

            Player unit = new Player();
            Unit bot = new Unit();
            Unit bot1 = new Unit();

            map.units[0] = unit;
            map.units[1] = bot;
            map.units[2] = bot1;

            unit.Face = (char)1;

            bot.Face = (char)2;
            bot.Possition = new Position(15, 15);

            bot1.Face = (char)3;
            bot1.Possition = new Position(16, 16);

            map.Print();

            for (; ; )
            {
                ConsoleKeyInfo consoleKeyInfo = Console.ReadKey();

                while (!Console.KeyAvailable)
                {
                    map.MoveUnit(consoleKeyInfo);

                    map.MoveBots();

                    map.Print();

                    Thread.Sleep(50);
                    //if (map.gameOver)
                    //{
                    //    break;
                    //}
                }
            }
        }