Ejemplo n.º 1
0
        private Item SelectItem()
        {
            int i = 0;
            int choice;

            Console.WriteLine("Choose an item.");
            foreach (var item in ItemBag)
            {
                Console.WriteLine($"{i++}. {item.ToStringItem()}");
            }
            choice = InputChoice.Choice();
            return(ItemBag.ElementAt(choice));
        }
Ejemplo n.º 2
0
        public virtual void Hit(List <Entity> enemies)
        {
            if (IsCharacter && isAlive)
            {
                Console.WriteLine("Who should I attack? HitMethod");
                List <string> s       = new List <string>();
                int           counter = 1;
                foreach (Entity enemyy in enemies)
                {
                    s.Add(enemyy.Name);
                    Console.WriteLine($"{counter} " + enemyy.Name + " " + enemyy.Hp + " hitpoints.");
                    counter++;
                }
                int choice = InputChoice.Choice();

                string name  = s[choice - 1];
                Entity enemy = enemies.FirstOrDefault(character => (character.Name == name && character.isAlive));

                if (enemy == null)
                {
                    Console.WriteLine($"Enemy is dead.");
                    return;
                }
                else
                {
                    Hit(enemy);
                }
            }
            else
            {
                Entity enemy = enemies.FirstOrDefault(character => character.isAlive);
                if (isAlive)
                {
                    if (enemy.isAlive)
                    {
                        Hit(enemy);
                    }
                    else
                    {
                        Console.WriteLine($"{Name} is dead.");
                        return;
                    }
                }
                else
                {
                    Console.WriteLine($"{Name} is dead.");
                    return;
                }
            }
        }
Ejemplo n.º 3
0
        public void CharacterAction()
        {
            Console.WriteLine($"I am {Name}. What should I do?");
            Console.WriteLine("1. Attack");
            Console.WriteLine("2. Use an item");

            int choice = InputChoice.Choice();

            switch (choice)
            {
            case 1:
            {
                Hit(CreatedCharacter.Enemies);
                break;
            }

            case 2:
            {
                var item = SelectItem();
                if (this.isAlive)
                {
                    if (item is ICharacterItemUse usable)
                    {
                        usable.Use(this);
                        Console.WriteLine($"{item.Name} was used.");
                    }
                    else
                    {
                        Console.WriteLine("Nie da sie");
                    }
                }
                else
                {
                    Console.WriteLine($"{Name} is already dead!");
                }

                break;
            }

            default:
            {
                Console.WriteLine("Choose from above!");
                Thread.Sleep(1500);
                Console.Clear();

                break;
            }
            }
        }
Ejemplo n.º 4
0
        public static void OptionsMenu()
        {
            Console.WriteLine("1. Difficulty");
            Console.WriteLine("2. Volume");
            Console.WriteLine("3. Graphics");
            Console.WriteLine("4. Exit");

            int choice = InputChoice.Choice();

            switch (choice)
            {
            case 1:
            {
                break;
            }

            case 2:
            {
                break;
            }

            case 3:
            {
                break;
            }

            case 4:
            {
                Console.Clear();
                StartScreen.MainOptions();
                break;
            }

            default:
            {
                Console.WriteLine("Choose again");
                Thread.Sleep(1000);
                Console.Clear();
                OptionsMenu();
                break;
            }
            }
        }
Ejemplo n.º 5
0
        public static void MainOptionsSwitch()
        {
            int choice = InputChoice.Choice();

            switch (choice)
            {
            case 1:
            {
                Console.Clear();
                Game.GameLogic();
                break;
            }

            case 2:
            {
                Console.Clear();
                Options.OptionsMenu();
                break;
            }

            case 3:
            {
                Console.Clear();
                ExitScreen.EndTheGame();
                break;
            }

            default:
            {
                Console.WriteLine("Choose again");
                Thread.Sleep(1000);
                Console.Clear();
                MainOptions();
                break;
            }
            }
        }