Exemple #1
0
 void CreateMapGameObject()
 {
     for (int i = 0; i < length; i++)
     {
         GAMEObject go = new GAMEObject();
         mapData[i] = go;
     }
 }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.SetBufferSize(120, 80);

            Boss boss = new Boss();

            boss.name = "尸王";
            boss.ATC  = 50;
            boss.Hp   = 150;
            boss.Sb   = 15;
            int numb   = 1;
            int Person = 0;

            while (true)
            {
                Console.CursorVisible = false;
                switch (numb)
                {
                case 1:
                {
                    Console.SetCursorPosition(55, 10);
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("鬼    吹     灯");
                    Console.SetCursorPosition(55, 13);
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("  之古墓逃脱");
                    Console.SetCursorPosition(57, 15);
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.WriteLine("1.开始游戏");
                    Console.ReadKey(true);
                    if ((Console.ReadKey(true).Key == ConsoleKey.D1) || (Console.ReadKey(true).Key == ConsoleKey.NumPad1))
                    {
                        numb = 2;
                        Console.Clear();
                        break;
                    }
                }
                break;

                case 2:
                {
                    while (true)
                    {
                        #region 第一幕
                        Console.SetCursorPosition(10, 5);
                        Console.WriteLine("一个风和日丽的早晨");
                        Console.ReadLine();
                        Console.SetCursorPosition(10, 6);
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.Write("小胡");
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.Write("  小王");
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.Write("  小刘");
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.Write("  小牙");
                        Console.WriteLine();
                        Console.SetCursorPosition(10, 7);
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.WriteLine("这四个中二病少年,又开始了他们的幻想");
                        Console.ReadLine();
                        Console.SetCursorPosition(10, 9);
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.Write("小胡:");
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write("好无聊啊,好想盗个墓");
                        Console.ReadLine();
                        Console.SetCursorPosition(10, 10);
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.Write("小王:");
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write("你看鬼吹灯看入迷了?天天想着挖别人祖坟吗?");
                        Console.ReadLine();
                        Console.Write("\t  --说实话我也想");
                        Console.ReadLine();
                        Console.SetCursorPosition(10, 12);
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.Write("小刘:");
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write("还真别说,我听说后山有人发现一个大洞,懂行的人说是什么将军的墓");
                        Console.ReadLine();
                        Console.SetCursorPosition(10, 13);
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.Write("小牙:");
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write("那还等什么啊!开拔!");
                        Console.ReadLine();
                        #endregion
                        Console.Clear();
                        Console.SetCursorPosition(10, 5);
                        Console.WriteLine("4人来到山洞前----");
                        Console.ReadLine();
                        Console.SetCursorPosition(10, 6);
                        Console.WriteLine("山洞里漆黑一片,但深处似乎有着什么.....");
                        Console.ReadLine();
                        Console.SetCursorPosition(10, 7);
                        Console.ForegroundColor = ConsoleColor.Cyan;
                        Console.Write("小牙:");
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write("要不还是算了吧....怪恐怖的");
                        Console.ReadLine();
                        Console.SetCursorPosition(10, 8);
                        Console.ForegroundColor = ConsoleColor.Blue;
                        Console.Write("小胡:");
                        Console.ForegroundColor = ConsoleColor.White;
                        Console.Write("(虽然也怕,但是还是装硬)喊来的是你,喊走的也是你,能不能不拉跨!");
                        Console.ReadLine();
                        Console.SetCursorPosition(10, 9);
                        Console.WriteLine("于是4人往洞里走去....他们还不知道,等待他们的是什么");
                        Console.ReadLine();
                        Console.Clear();
                        numb = 3;
                        break;
                    }
                }
                break;

                case 3:
                {
                    Console.BackgroundColor = ConsoleColor.Black;
                    Console.SetCursorPosition(55, 5);
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.WriteLine("请选择你扮演的角色");
                    Console.SetCursorPosition(40, 10);
                    Console.ForegroundColor = ConsoleColor.Blue;
                    Console.WriteLine("1.胡巴二    2.王瘦子    3.雪莉刘    4.大银牙");
                    Console.SetCursorPosition(40, 12);
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("攻击力中    攻击力高    攻击力中    攻击力低");
                    Console.SetCursorPosition(40, 13);
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("闪避率中    闪避率低    闪避率高    闪避率低");
                    Console.SetCursorPosition(40, 14);
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine("生命值中    生命值高    生命值低    生命值低");
                    switch (Console.ReadKey(true).Key)
                    {
                    case ConsoleKey.D1:
                        Person = 1;
                        numb   = 4;

                        break;

                    case ConsoleKey.D2:
                        Person = 2;
                        numb   = 4;
                        break;

                    case ConsoleKey.D3:
                        Person = 3;
                        numb   = 4;
                        break;

                    case ConsoleKey.D4:
                        Person = 4;
                        numb   = 4;
                        break;
                    }
                }
                    Console.Clear();
                    break;

                case 4:
                {
                    Console.SetCursorPosition(90, 26);
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine("怪--遭遇怪物");
                    Console.SetCursorPosition(90, 27);
                    Console.ForegroundColor = ConsoleColor.Gray;
                    Console.WriteLine("井--触碰陷阱");
                    Console.SetCursorPosition(90, 28);
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("◎--获得宝物");
                    Vector2 pos = new Vector2();
                    pos.x = 1;
                    pos.y = 1;

                    Map map = new Map();
                    map.RandomData(pos, 5);
                    map.DrawMap();



                    GAMEObject picl = new GAMEObject();
                    picl.pos  = map.mapData[0].pos;
                    picl.type = E_GameObjectType.Player;


                    Player p1 = new Player();



                    switch (Person)
                    {
                    case 1:
                    {
                        p1.name = "胡巴二";
                        p1.ATC  = 15;
                        p1.Hp   = 100;
                        p1.Sb   = 20;
                        Console.SetCursorPosition(90, 20);
                        Console.WriteLine("" + p1.name);
                        Console.SetCursorPosition(90, 21);
                        Console.WriteLine("生命值 " + p1.Hp + " ");
                        Console.SetCursorPosition(90, 22);
                        Console.WriteLine("攻击力 " + p1.ATC + " ");
                        Console.SetCursorPosition(90, 23);
                        Console.WriteLine("闪避率 " + p1.Sb + " ");
                    }
                    break;

                    case 2:
                    {
                        p1.name = "王瘦子";
                        p1.ATC  = 20;
                        p1.Hp   = 120;
                        p1.Sb   = 10;
                        Console.SetCursorPosition(90, 20);
                        Console.WriteLine("" + p1.name);
                        Console.SetCursorPosition(90, 21);
                        Console.WriteLine("生命值 " + p1.Hp + " ");
                        Console.SetCursorPosition(90, 22);
                        Console.WriteLine("攻击力 " + p1.ATC + " ");
                        Console.SetCursorPosition(90, 23);
                        Console.WriteLine("闪避率 " + p1.Sb + " ");
                    }
                    break;

                    case 3:
                    {
                        p1.name = "雪莉刘";
                        p1.ATC  = 15;
                        p1.Hp   = 80;
                        p1.Sb   = 30;
                        Console.SetCursorPosition(90, 20);
                        Console.WriteLine("" + p1.name);
                        Console.SetCursorPosition(90, 21);
                        Console.WriteLine("生命值 " + p1.Hp + " ");
                        Console.SetCursorPosition(90, 22);
                        Console.WriteLine("攻击力 " + p1.ATC + " ");
                        Console.SetCursorPosition(90, 23);
                        Console.WriteLine("闪避率 " + p1.Sb + " ");
                    }
                    break;

                    case 4:
                    {
                        p1.name = "大银牙";
                        p1.ATC  = 10;
                        p1.Hp   = 80;
                        p1.Sb   = 10;
                        Console.SetCursorPosition(90, 20);
                        Console.WriteLine("" + p1.name);
                        Console.SetCursorPosition(90, 21);
                        Console.WriteLine("生命值 " + p1.Hp + " ");
                        Console.SetCursorPosition(90, 22);
                        Console.WriteLine("攻击力 " + p1.ATC + " ");
                        Console.SetCursorPosition(90, 23);
                        Console.WriteLine("闪避率 " + p1.Sb + " ");
                    }
                    break;
                    }

                    p1.piece = picl;

                    p1.piece.Draw();

                    while (true)
                    {
                        Console.SetCursorPosition(90, 14);
                        Console.WriteLine("按回车键投掷色子移动");
                        Console.ReadLine();
                        Console.SetCursorPosition(90, 14);
                        Console.WriteLine("                    ");

                        p1.Move(map);
                        p1.MapEvent(map, p1);
                        map.DrawMap();
                        p1.piece.Draw();
                    }
                }
                break;
                }
            }
        }