Beispiel #1
0
        public static void Main(string[] args)
        {
            InputManager im = new InputManager();
            Player       p  = new Player();
            Field        f  = new Field();

            im.ListenAsync();
            im.player = p;
            im.field  = f;

            im.ListenAsync();

            f.fillField();
            f.SetBonuses();
            f.SetObstruction();
            f.SetHero(0, 9, p);

            DrawEngine.player = p;
            DrawEngine.drawFieldSync(f);
        }
Beispiel #2
0
        void input()
        {
            while (true)
            {
                var number = Console.ReadKey(true).Key;
                switch (number)
                {
                case ConsoleKey.S:
                {
                    if (player.X == field.GetStats()[0] - 1)
                    {
                        field.SetHero(0, player.Y, player);
                    }
                    else
                    {
                        field.SetHero(player.X + 1, player.Y, player);
                    }

                    DrawEngine.drawFieldSync(field);
                    break;
                }

                case ConsoleKey.W:
                {
                    if (player.X == 0)
                    {
                        field.SetHero(field.GetStats()[0] - 1, player.Y, player);
                    }
                    else
                    {
                        field.SetHero(player.X - 1, player.Y, player);
                    }

                    DrawEngine.drawFieldSync(field);
                    break;
                }

                case ConsoleKey.A:
                {
                    if (player.Y == 0)
                    {
                        field.SetHero(player.X, field.GetStats()[1] - 1, player);
                    }
                    else
                    {
                        field.SetHero(player.X, player.Y - 1, player);
                    }

                    DrawEngine.drawFieldSync(field);
                    break;
                }

                case ConsoleKey.D:
                {
                    if (player.Y == field.GetStats()[1] - 1)
                    {
                        field.SetHero(player.X, 0, player);
                    }
                    else
                    {
                        field.SetHero(player.X, player.Y + 1, player);
                    }

                    DrawEngine.drawFieldSync(field);
                    break;
                }

                default:
                    break;
                }
                Thread.Sleep(Options.DRAW_LATENCY);
            }
        }