public static List <string> PlayerCreate(LudoDbContext context, Game game, List <string> CurrentColors, int PlayerAmount)
        {
            Console.WriteLine("Whats your name player?");
            var CurrentName = Console.ReadLine();

            Console.Clear();
            Console.WriteLine("Welcome " + CurrentName + " Whats your preferred color?");

            var SelectedColor = MenuNavigator.Menu.ShowMenu(CurrentColors);

            CurrentColors = Banner.ListBan(SelectedColor, CurrentColors);

            Console.WriteLine("You have successfully chosen the color " + SelectedColor + "!");
            var gamer = PlayerFactory.Create(CurrentName, SelectedColor, false);

            game.Players.Add(gamer);
            context.SaveChanges();

            PlayerAmount--;
            if (0 < PlayerAmount)
            {
                CurrentColors = PlayerCreate(context, game, CurrentColors, PlayerAmount);
            }
            return(CurrentColors);
        }
Beispiel #2
0
        public static void CreateBots(LudoDbContext context, Game game, List <string> currentColors)
        {
            List <string> BotNames = new List <string>();

            BotNames.AddRange(new string[] { "Lion", "Panda", "Tiger" });
            var BotAmount = currentColors.Count;

            for (int i = 0; i < BotAmount; i++)
            {
                var Name = Randomizer.ListRandomizer(BotNames);
                BotNames = Banner.ListBan(Name, BotNames);
                var Color = Randomizer.ListRandomizer(currentColors);
                currentColors = Banner.ListBan(Color, currentColors);
                var bot = PlayerFactory.Create(Name, Color, true);

                game.Players.Add(bot);
            }
        }