예제 #1
0
        static void Main(string[] args)
        {
            En  = Engine.Letsgo;
            Inf = Inform.Information;
            Lvl = Map.ThisWorld;

            Inf.HelloWorld();
            Inf.HelloNeo();
            En.AddHero();
            En.AddItem();

            Lvl.frame.Clear();
            Lvl.buildLevelMap();
        }
예제 #2
0
파일: Map.cs 프로젝트: Siloda/HahaDota
        public void tryAgain()
        {
            bool re = true;

            while (re)
            {
                Console.WriteLine("Try again?");
                Console.WriteLine("1 - Yes");
                Console.WriteLine("2 - No");
                // coupleSolo();
                Map    World = Map.ThisWorld;
                Inform inf   = Inform.Information;
                string again = Console.ReadLine();


                switch (again)
                {
                case "1":
                    World.frame.Clear();
                    World.buildLevelMap();
                    break;

                case "2":

                    gameStatus = false;
                    inf.Bye();
                    World.frame.Clear();

                    break;

                default:
                    Console.Clear();
                    Console.WriteLine("Wrong!!!");

                    break;
                }

                if (again == "2")
                {
                    re = false;
                }
            }
        }
예제 #3
0
파일: Engine.cs 프로젝트: Siloda/HahaDota
        public void Match()
        {
            AddHero();
            Inform inform = Inform.Information;
            Random hero   = new Random();


            int hero1Index = hero.Next(0, 4);
            int hero2Index = hero1Index;

            while (hero1Index == hero2Index)
            {
                hero2Index = hero.Next(0, 4);
            }


            Random item       = new Random();
            int    item1Index = item.Next(0, 2);
            int    item2Index = item1Index;

            while (item1Index == item2Index)
            {
                item2Index = item.Next(0, 3);
            }



            En.heroesList[hero1Index].takeItem(hero1Index, item1Index);
            En.heroesList[hero2Index].takeItem(hero2Index, item2Index);



            while (En.heroesList[hero1Index].hp > 0 && En.heroesList[hero2Index].hp > 0)

            {
                Console.Clear();
                Console.WriteLine((En.heroesList[hero1Index].getInfo()) + " \n   " + "\n" + (En.heroesList[hero2Index].getInfo()));
                Thread.Sleep(1000);
                En.heroesList[hero1Index].HitHero(hero2Index);
                Thread.Sleep(1000);
                En.heroesList[hero2Index].HitHero(hero1Index);
                Console.Clear();
            }

            if (En.heroesList[hero1Index].hp > 0 && En.heroesList[hero2Index].hp <= 0)
            {
                return;
            }



            else if (En.heroesList[hero1Index].hp <= 0 && En.heroesList[hero2Index].hp > 0)
            {
                Console.WriteLine("2nd win");
            }

            else if (En.heroesList[hero1Index].hp <= 0 && En.heroesList[hero2Index].hp <= 0)
            {
                inform.Draw();
            }
        }
예제 #4
0
파일: Map.cs 프로젝트: Siloda/HahaDota
        public void MoveHero(ConsoleKeyInfo keyInfo)
        {
            Inform Inf = Inform.Information;
            Engine En  = Engine.Letsgo;

            for (int x = frame.Count - 1; x >= 0; x--)
            {
                for (int y = 0; y < frame[x].Length; y++)
                {
                    if (frame[x][y] == hero)
                    {
                        if (keyInfo.Key == ConsoleKey.UpArrow)
                        {
                            if ((x - 1) >= 0 && frame[x - 1][y] == emptyCell)
                            {
                                frame[x][y]     = emptyCell;
                                frame[x - 1][y] = hero;
                                return;
                            }
                            if ((x - 1) >= 0 && frame[x - 1][y] == enemy)
                            {
                                frame[x][y]     = emptyCell;
                                frame[x - 1][y] = hero;
                                En.Match();
                                return;
                            }
                            if ((x - 1) >= 0 && frame[x - 1][y] == exit)
                            {
                                frame[x][y]     = emptyCell;
                                frame[x - 1][y] = hero;
                                Inf.Winner();
                                return;
                            }
                        }

                        else if (keyInfo.Key == ConsoleKey.DownArrow)
                        {
                            if ((x + 1) <= (frame.Count - 1) && frame[x + 1][y] == emptyCell)
                            {
                                frame[x][y]     = emptyCell;
                                frame[x + 1][y] = hero;
                                return;
                            }
                            else if ((x + 1) <= (frame.Count - 1) && frame[x + 1][y] == enemy)
                            {
                                frame[x][y]     = emptyCell;
                                frame[x + 1][y] = hero;
                                En.Match();
                                return;
                            }
                            else if ((x + 1) <= (frame.Count - 1) && frame[x + 1][y] == exit)
                            {
                                frame[x][y]     = emptyCell;
                                frame[x + 1][y] = hero;
                                Inf.Winner();;
                                return;
                            }
                        }
                        else if (keyInfo.Key == ConsoleKey.LeftArrow)
                        {
                            if ((y - 1) >= 0 && frame[x][y - 1] == emptyCell)
                            {
                                frame[x][y]     = emptyCell;
                                frame[x][y - 1] = hero;
                            }
                            else if ((y - 1) >= 0 && frame[x][y - 1] == enemy)
                            {
                                frame[x][y]     = emptyCell;
                                frame[x][y - 1] = hero;
                                En.Match();
                                return;
                            }
                            else if ((y - 1) >= 0 && frame[x][y - 1] == exit)
                            {
                                frame[x][y]     = emptyCell;
                                frame[x][y - 1] = hero;
                                Inf.Winner();
                                return;
                            }
                        }
                        else if (keyInfo.Key == ConsoleKey.RightArrow)
                        {
                            if ((y + 1) <= (frame[x].Length - 1) && frame[x][y + 1] == emptyCell)
                            {
                                frame[x][y]     = emptyCell;
                                frame[x][y + 1] = hero;
                                return;
                            }
                            else if ((y + 1) <= (frame[x].Length - 1) && frame[x][y + 1] == enemy)
                            {
                                frame[x][y]     = emptyCell;
                                frame[x][y + 1] = hero;
                                En.Match();
                                return;
                            }
                            else if ((y + 1) <= (frame[x].Length - 1) && frame[x][y + 1] == exit)
                            {
                                frame[x][y]     = emptyCell;
                                frame[x][y + 1] = hero;
                                Inf.Winner();
                                return;
                            }
                        }
                    }
                }
            }
        }