Exemple #1
0
        private static void Main()
        {
            var r  = new Random();
            var gc = new GameClient("localhost:8080", "*****@*****.**", "123");

            gc.Run(() =>
            {
                var done = false;

                switch (r.Next(5))
                {
                case 0:
                    if (IsBlock(gc.Map[gc.PlayerX, gc.PlayerY - 1]) == false)
                    {
                        gc.Up();
                        done = true;
                    }
                    break;

                case 1:
                    if (IsBlock(gc.Map[gc.PlayerX + 1, gc.PlayerY]) == false)
                    {
                        gc.Right();
                        done = true;
                    }
                    break;

                case 2:
                    if (IsBlock(gc.Map[gc.PlayerX, gc.PlayerY + 1]) == false)
                    {
                        gc.Down();
                        done = true;
                    }
                    break;

                case 3:
                    if (IsBlock(gc.Map[gc.PlayerX - 1, gc.PlayerY]) == false)
                    {
                        gc.Left();
                        done = true;
                    }
                    break;

                case 4:
                    gc.Act();
                    done = true;
                    break;
                }
                if (done == false)
                {
                    gc.Blank();
                }
            });

            Console.ReadKey();
        }