示例#1
0
        public static void LogIn()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("LOGIN: \n");

                Console.Write("Enter nickname: ");
                string nickName = Console.ReadLine();

                Console.Write("Enter password: "******".xml";
                if (File.Exists(path))
                {
                    //Hero hero = new Hero();
                    Hero.Instance.Name = nickName;

                    Hero.LoadHero(ref Hero.Instance);

                    if (Hero.Instance.Password == passWord)
                    {
                        Console.Clear();
                        Console.WriteLine("Login successful!");
                        Console.WriteLine("\nPress any key to continue...");
                        Console.ReadKey();

                        Meniu.MeniuPrincipal();
                        break;
                    }
                    else
                    {
                        Console.Clear();
                        Console.WriteLine("Login or password incorrect... Try again!");
                        Console.WriteLine("\nPress any key to continue...");
                        Console.ReadKey();
                    }
                }
                else
                {
                    Console.Clear();
                    Console.WriteLine("Account inexistent");
                    Console.WriteLine("\nPress any key to continue...");
                    Console.ReadKey();

                    Meniu.MeniuLogin();
                }
            }
        }
示例#2
0
 static void Main(string[] args)
 {
     Meniu.MeniuPrincipal();
 }
示例#3
0
        public static void StartBattle()
        {
            if (Hero.Instance.Level == 1)
            {
                Hero.Instance.HP     = 500;
                Hero.Instance.Damage = 50;
            }

            List <Enemy> en = new List <Enemy>();

            int EnemiesNr = Hero.Instance.GameLevel + 2;

            for (int i = 0; i < EnemiesNr; i++)
            {
                en.Add(new Enemy());
            }

            while (true)           // (hero.HP > 0) // am facut asa pt ca la noi totul este verificat si el stie cand trebuie sa intrerupa loop-ul prin break
            {
                if (en[0].HP <= 0) //cand il maceste pe un enemy
                {
                    en.RemoveAt(0);
                    Console.Clear();
                    Afisare.EnemyDestroyed();
                    Thread.Sleep(1000); //1000

                    Console.Clear();



                    Hero.Instance.Exp += 10;
                    if (Hero.Instance.Exp >= Hero.Instance.Exp_Per_Level)
                    {
                        Hero.Instance.Level++;
                        Hero.Instance.Exp_Per_Level = Hero.Instance.Exp_Per_Level * 2 + (Hero.Instance.Exp_Per_Level / 4);
                    }

                    if (en.Count == 0)
                    {
                        Hero.Instance.HP = 500 + (200 * (Hero.Instance.Level / 10));
                        Hero.Instance.SaveHero();

                        Hero.Instance.GameLevel++;

                        Afisare.WinMessage();
                        Thread.Sleep(1500);
                        //hero.Level++;
                        NextLevel.LevelNext();
                        break;
                    }
                }
                else
                {
                    Console.Clear();
                    Afisare.ShowScreen(Hero.Instance.Name, Hero.Instance.HP, en[0].HP, Hero.Instance.Level, Hero.Instance.Exp, en.Count);
                    Hero.Instance.HP -= en[0].Damage;
                    Thread.Sleep(1000); //1000

                    en[0].HP -= Hero.Instance.Damage;
                    Console.Clear();
                    Afisare.ShowScreen(Hero.Instance.Name, Hero.Instance.HP, en[0].HP, Hero.Instance.Level, Hero.Instance.Exp, en.Count);
                    Thread.Sleep(1000); //1000
                }

                if (Hero.Instance.HP < 0)
                {
                    Hero.Instance.HP = 500 + (200 * (Hero.Instance.Level / 10));
                    Hero.Instance.SaveHero();

                    Afisare.LostMessage();
                    Thread.Sleep(1500);

                    Meniu.MeniuPrincipal();
                    break;
                }
            } //while
        }