private void InitializeDescriptions() { var fixDescriptions = InfoGenerator.GetTenFixFrequencyDescriptors(); var Descriptions = InfoGenerator.GetTenFrequencyDescriptors(); descriptions.Add(new RadioTaskDescription() { Type = RadioTaskType.InitialState, Description = InfoGenerator.Descriptions[RadioTaskType.InitialState] }); descriptions.Add(new RadioTaskDescription() { Type = RadioTaskType.PrepareStationForWork, Description = InfoGenerator.Descriptions[RadioTaskType.PrepareStationForWork] }); descriptions.Add(new RadioTaskDescription() { Type = RadioTaskType.CheckStation, Description = InfoGenerator.Descriptions[RadioTaskType.CheckStation] }); descriptions.Add(new RadioTaskDescription() { Type = RadioTaskType.Frequency, Description = InfoGenerator.Descriptions[RadioTaskType.Frequency], Frequencys = Descriptions, SelectedItem = Descriptions.First() }); descriptions.Add(new RadioTaskDescription() { Type = RadioTaskType.FixFrequency, Description = InfoGenerator.Descriptions[RadioTaskType.FixFrequency], Frequencys = fixDescriptions, SelectedItem = fixDescriptions.First() }); }
public void Fight(List <Rounds> log) { Console.Clear(); Console.WriteLine("Getting the random attributes"); Random dice = new Random(); Characters playerSet = new Characters(dice.Next(2, 8), dice.Next(2, 8), dice.Next(2, 8)); //Player character random attributes Characters npcSet = new Characters(dice.Next(2, 8), dice.Next(2, 8), dice.Next(2, 8)); //NPC random attributes InfoGenerator NPC = new InfoGenerator(DateTime.Now.Millisecond); // Gender Sex = Gender.Male; //NPC random name Characters npcName = new Characters { Name = NPC.NextFirstName(Sex) }; /// Console.WriteLine($"Your DMG: {playerSet.Damage} HP: {playerSet.Health} STR: {playerSet.Strength}"); Console.WriteLine($"{npcName.Name} DMG: {npcSet.Damage} HP: {npcSet.Health} STR: {npcSet.Strength}"); TextColor("- Prepare to Fight -(Press any key)", ConsoleColor.Green); Console.ReadKey(true); do { playerSet.Strength += playerSet.Strength + dice.Next(2, 8); //adds new random set of to strength to strength npcSet.Strength += npcSet.Strength + dice.Next(2, 8); TextColor($"Your new Strenght is: {playerSet.Strength}\n{npcName.Name} Strength is: {npcSet.Strength}", ConsoleColor.Green); if (playerSet.Strength > npcSet.Strength) //if playerstrenght is highter than NPCs then... { npcSet.Health -= playerSet.Damage; TextColor($"You hit {npcName.Name} with {playerSet.Damage}", ConsoleColor.Magenta); Console.WriteLine($"{npcName.Name} HP is: {npcSet.Health}"); } else if (npcSet.Strength > playerSet.Strength) //if NPC strength is higher than Player then... { playerSet.Health -= npcSet.Damage; TextColor($"{npcName.Name} hit you with {npcSet.Damage}", ConsoleColor.Red); Console.WriteLine($"Your HP is: {playerSet.Health}"); } else //the possibility that both player and NPC has the same amount of strength then .... { TextColor("Parry!! both participant looses 1 DMG", ConsoleColor.Green); playerSet.Damage -= 1; npcSet.Damage -= 1; Console.WriteLine($"Your DMG is now {playerSet.Damage}\n{npcName.Name} DMG is now {npcSet.Damage}"); } } while (playerSet.Health > 0 && npcSet.Health > 0); if (playerSet.Health <= 0) //if player health is less or equal to 0 then... { lost++; TextColor("You Loose", ConsoleColor.Red); log.Add(new Rounds(0, lost)); } else //else you won ;) { won++; TextColor("You Win", ConsoleColor.Yellow); log.Add(new Rounds(won, 0)); } }
static string NameGenerator() { Random randomInt = new Random(); var nameGenerator = new InfoGenerator(randomInt.Next(1, 101)); string name = nameGenerator.NextFirstName(Gender.Male); return(char.ToUpper(name[0]) + name.Substring(1)); }
public void Merchant(int seed) { InfoGenerator infoGenerator = new InfoGenerator(seed); TextInfo textInfo = new CultureInfo("en-US").TextInfo; var merchant = textInfo.ToTitleCase(infoGenerator.NextFirstName()); Console.WriteLine("Merchant " + merchant); }
IEnumerator DestructionAfterTime() { yield return(new WaitForSeconds(destructionTime)); InfoGenerator iG = GameObject.FindGameObjectWithTag("GameInfoGenerator").GetComponent <InfoGenerator>(); iG.MakeInfoObject("Black Hole End"); Destroy(gameObject); }
public string RandomizeName() { InfoGenerator randomEnemy = new InfoGenerator(DateTime.Now.Millisecond); TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; var enemyName = randomEnemy.NextFullName(); var name = textInfo.ToTitleCase(enemyName); return(name); }
public void Tavern(int seed) { InfoGenerator infoGenerator = new InfoGenerator(seed); TextInfo textInfo = new CultureInfo("en-US").TextInfo; var personality = textInfo.ToTitleCase(infoGenerator.NextPersonality()); var questgiver = textInfo.ToTitleCase(infoGenerator.NextFullName()); Console.WriteLine("You meet " + questgiver + " the " + personality); }
static void Main(string[] args) { Battle start_battle = new Battle(); Character start_chars = new Character(); List <int[]> player_char = new List <int[]>(); List <int[]> enemies_char = new List <int[]>(); player_char = start_chars.battle_charactor_setup(); enemies_char = start_chars.battle_charactor_setup(); start_battle.Main_menu_print(); string player_name = Console.ReadLine(); //Auto gen enemies fname InfoGenerator rand_enmy_name = new InfoGenerator(); string enemies_name = rand_enmy_name.NextFirstName(); start_battle.sub_menu(player_char, player_name); bool correct_selection = false; // string user_menu_select = Console.ReadKey().KeyChar.ToString().ToLower(); while (false == correct_selection) { string user_menu_select = Console.ReadKey().KeyChar.ToString().ToLower(); if ("b" == user_menu_select) { console_write("Battle selected"); correct_selection = true; } else if ("q" == user_menu_select) { Environment.Exit(0); } else { start_battle.sub_menu(player_char, player_name); } } Console.ReadKey(); //Helper to console print void console_write(string text_to_con, bool new_line = false) { if (false != new_line) { Console.WriteLine(text_to_con); } else { Console.Write(text_to_con); } } }
protected override void Seed(Contacts.Models.PeopleDB context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // context.Person.AddOrUpdate( P => P.Email, new People { FirstName = "Firas", LastName = "Alwarea", TelephoneNo = "0762620287", Email = "*****@*****.**" }, new People { FirstName = "Husam", LastName = "Jammal", TelephoneNo = "076222222", Email = "*****@*****.**" }, new People { FirstName = "Shadi", LastName = "Jbawi", TelephoneNo = "0767777777", Email = "*****@*****.**" } ); InfoGenerator rndInfo = new InfoGenerator(DateTime.Now.Ticks.GetHashCode()); for (int i = 1; i < 10; i++) { context.Person.AddOrUpdate( P => P.Email, new People { FirstName = rndInfo.NextFirstName(), LastName = rndInfo.NextLastName(), TelephoneNo = "076" + rndInfo.Next(1, 10000), Email = FirstName + "." LastName + "@gmail.com" }
// This constructor will be used to generate enemies public Character(Weapon weapon, Armor armor) { //Make a random number generator, put a random number in the "seed", //and use that to pull a random name from InfoGenerator Random randomGenerator = new Random(); int seed = randomGenerator.Next(); InfoGenerator randomName = new InfoGenerator(seed); characterName = randomName.NextFullName(); GenerateAttributes(); GenerateGear(weapon, armor); UpdateDerivedAttributes(); UpdateMoney(0); UpdateScore(0); }
public void Town(int seed) { InfoGenerator infoGenerator = new InfoGenerator(seed); TextInfo textInfo = new CultureInfo("en-US").TextInfo; var town = textInfo.ToTitleCase(infoGenerator.NextCity()); Console.WriteLine("You are in the town of " + town); Console.WriteLine("0 - Retire\n1 - Vist The Tavern\n2 - Visit The Markets\n3 - Fight in the Arena\n4 - Wander out in the Wilderness\n5 - View Log"); var op = Console.ReadKey(true).Key; switch (op) { case ConsoleKey.D0: case ConsoleKey.NumPad0: //retire break; case ConsoleKey.D1: case ConsoleKey.NumPad1: Tavern(seed); break; case ConsoleKey.D2: case ConsoleKey.NumPad2: Merchant(seed); break; case ConsoleKey.D3: case ConsoleKey.NumPad3: //fight break; case ConsoleKey.D4: case ConsoleKey.NumPad4: //wander break; case ConsoleKey.D5: case ConsoleKey.NumPad5: //view log break; default: break; } }
public static void WeaveRouteStopIntoBusStop(InfoGenerator generator) { Console.WriteLine("Extracting bus stop names from Route-Stop Component..."); Dictionary <int, string> stopNameMapping = generator.routeStopExtractor.PrepareStopNames(); Console.WriteLine("Extraction complete."); Console.WriteLine("Assigning stop names to bus stops..."); foreach (BusStop busStop in generator.busStopExtractor.LoadedBusStops) { int stopID = int.Parse(busStop.StopID); if (stopNameMapping.ContainsKey(stopID)) { busStop.StopName = stopNameMapping[stopID]; } } Console.WriteLine("Assignment complete."); }
static public void Initialize() { infoGenerator = new InfoGenerator(Game.RNG.Next(30000)); strengthAffixes = new string[, ] { { "Fighter's", "Soldier's", "Champion's" }, { "of the Ox", "of the Bear", "of the Giant" } }; dexterityAffixes = new string[, ] { { "Acrobat's", "Assassin's", "Ninja's" }, { "of the Wolf", "of the Viper", "of the Cheetah" } }; constitutionAffixes = new string[, ] { { "Defender's", "Guardian's", "Sentinel's" }, { "of the Tortoise", "of the Hippo", "of the Troll" } }; focusAffixes = new string[, ] { { "Calming", "Clear", "Serene" }, { "of the Owl", "of the Hawk", "of the Eagle" } }; }
private Standarts() { InitializeComponent(); rangeArray = new int[] { 1, 2, 3, 4 }; descriptor = InfoGenerator.GetTenFrequencyDescriptors().Select(x => new FrequencyDescriptor() { Parameter = x.Parameter.Frequency }).ToArray(); comboBox = new ComboBox() { ItemsSource = descriptor, SelectedValue = descriptor[0], FontSize = 24 }; comboBox2 = new ComboBox() { ItemsSource = rangeArray, SelectedValue = rangeArray[0], FontSize = 24 }; }
public static ITask CreateForFixFrequency(MainModel radio, double frequency, int range) { //InitializeTuningControls(radio); var sub = (int)InfoGenerator.GetSubFrequencyStateFor(frequency); Conditions conditions = new Conditions(); conditions .Add(() => radio.WorkMode.Value == WorkModeState.Simplex) // simplex .Add(() => radio.Noise.Value == 1.0) // noise .Add(() => radio.Voltage.Value == 0) // voltage .Add(() => radio.Scale.Value == Turned.On) //scale .Add(() => radio.Power.Value == Turned.On) // power .Add(() => radio.Volume.Value == 1.0) // volume .Add( () => radio.AntennaForFixedFrequency(range, sub) > 0.8) // antenna .Add( () => radio.ValuesFixedFrequency(sub, range).CompareInRange(frequency, DoubleExtentions.AcceptableRangeForFrequency)); Descriptions desctiptions = new Descriptions(); desctiptions .Add("Не установлен \"СИМПЛЕКС\".") .Add("Не установлена Ручка \"ШУМЫ\" влево до упора.") .Add("Не установлен Переключатель контроля напряжений в положении \"РАБОТА 1\".") .Add("Не установлены Тумблер \"ШКАЛА\" в положение \"ВКЛ\".") .Add("Не установлены Тумблер \"ПИТАНИЕ\" в положение \"ВКЛ\".") .Add("Не установлен Регулятор \"ГРОМКОСТЬ\" вправо до упора.") .Add("Не настроена антенна.") .Add("Не установлена фиксированная частота."); return(new TaskModelNotSequance(conditions, desctiptions, () => InitializeTuningControls(radio))); }
//The method for the menu for picking Opponent or retire. public void FightSelection(Characters character, List <string> rounds) { InfoGenerator names = new InfoGenerator(DateTime.Now.Millisecond); Gender gender = Gender.Any; bool fight = true; Console.WriteLine("\nTime to Decide if you wanna bring your Champion into battle. \n1. Find opponent.\n2. Shop \n3. Retire."); while (fight) { int input = GetInput(); switch (input) { case '1': Console.WriteLine("\nFinding opponent get ready for battle.\n"); character.Opponent = names.NextFirstName(gender); character.EHealth = D8() + 20; character.EDamage = D8() + 2; character.EStrenght = D4() + 3; fight = false; Rounds start = new Rounds(character, rounds); break; case '2': Console.Clear(); Console.WriteLine("Store hold following items.\n1. Health potion: +30 health for 2 gold.\n2. Sharpening stone: +3 damage for 5 gold.\n3. Sparring session: +3 strenght for 10 gold\n4. Knight status: + 30 Health, +3 Damage, + 3 Strenght for 30 gold"); input = GetInput(); if (input == '1' && character.Gold >= 2) { Console.WriteLine("You bought a health potion."); character.PHealth += 30; character.Gold -= 2; } else if (input == '2' && character.Gold >= 5) { Console.WriteLine("You bought a sharpening stone."); character.PDamage += 3; character.Gold -= 5; } else if (input == '3' && character.Gold >= 10) { Console.WriteLine("You bought a sparring session."); character.PStrenght += 3; character.Gold -= 10; } else if (input == '4' && character.Gold >= 1) { if (input == '4' && !character.Player.Contains("Knight")) { Console.WriteLine("You allrady bought Knight status."); } else { Console.WriteLine("You bought Knight status."); character.Player += " Knight"; character.PHealth += 30; character.PDamage += 3; character.PStrenght += 3; character.Gold -= 1; } } else { Console.WriteLine("Not enough gold or wrong input"); } Console.WriteLine("\nPush any key to return to fight menu."); Console.ReadKey(); Console.Clear(); Console.WriteLine($"\nChampion : {character.Player}\nStats = Health: {character.PHealth} Damage: {character.PDamage} Strenght: {character.PStrenght}"); Console.WriteLine("\nTime to Decide if you wanna bring your Champion into battle. \n1. Find opponent.\n2. Shop \n3. Retire."); break; case '3': bool confirm = true; Console.Clear(); while (confirm) { Console.WriteLine("You sure you wanna retire?\n1. Yes\n2. no"); input = GetInput(); if (input == '1') { Console.WriteLine("\nYou are retire your champion.\nPress any key to see your score.\n"); character.PHealth = 0; fight = false; confirm = false; Console.ReadKey(); Console.Clear(); } else if (input == '2') { Console.Clear(); Console.WriteLine("Time to Decide if you wanna bring your Champion into battle. \n1.Find opponent.\n2.Shop \n3.Retire."); confirm = false; } else { Console.WriteLine("Wrong input"); confirm = true; } } break; default: Console.WriteLine("wrong input"); break; } } }
protected override void Seed(GladiatorProject.Models.ApplicationDbContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. var roleStore = new RoleStore <IdentityRole>(context); var roleManager = new RoleManager <IdentityRole>(roleStore); if (!roleManager.RoleExists("Overlord")) { roleManager.Create(new IdentityRole("Overlord")); //Creating the admin role if it don't exist. } if (!roleManager.RoleExists("Support")) { roleManager.Create(new IdentityRole("Support")); // Creating the player role if it don't exist. } if (!roleManager.RoleExists("Player")) { roleManager.Create(new IdentityRole("Player")); // Creating the player role if it don't exist. } var userStore = new UserStore <ApplicationUser>(context); var userManager = new UserManager <ApplicationUser>(userStore); if (userManager.FindByEmail("*****@*****.**") == null) { ApplicationUser Overlord = new ApplicationUser() { Email = "*****@*****.**", UserName = "******", AccountHighScore = -1, Employment = "Admin" }; userManager.Create(Overlord, "As!1234"); userManager.AddToRole(userManager.FindByEmail("*****@*****.**").Id, "Overlord"); // Creating the admin name and password and adding him to the role. } if (userManager.FindByEmail("*****@*****.**") == null) { ApplicationUser Player = new ApplicationUser() { Email = "*****@*****.**", UserName = "******" }; userManager.Create(Player, "As!1234"); userManager.AddToRole(userManager.FindByEmail("*****@*****.**").Id, "Player"); // Creating a player name and password and adding him to the role. } //context.ClassRoles.AddOrUpdate( // c => c.Name, // new ClassRole { Name = "Murmillo", Weapon = "Sword and Heavy Shield", Armor = 5, Damage = 5, Health = 20 }, // new ClassRole { Name = "Retiarius", Weapon = "Trident and Net", Armor = 2, Damage = 9, Health = 20 }, // new ClassRole { Name = "Dimachaerus", Weapon = "Sword and Sword", Armor = 3, Damage = 7, Health = 20 }, // new ClassRole { Name = "Cestus", Weapon = "knuckleduster", Armor = 1, Damage = 10, Health = 20 } // ); InfoGenerator names = new InfoGenerator(DateTime.Now.Millisecond); Gender gender = Gender.Any; // Adding a list of 100 opponents from lvl 1 to 20 with random names to database. if (context.Opponents.Count() < 100) { context.Opponents.AddOrUpdate( i => i.Name, new Opponent { Name = names.NextFullName(gender), Level = 1 }, new Opponent { Name = names.NextFullName(gender), Level = 1 }, new Opponent { Name = names.NextFullName(gender), Level = 1 }, new Opponent { Name = names.NextFullName(gender), Level = 1 }, new Opponent { Name = names.NextFullName(gender), Level = 1 }, new Opponent { Name = names.NextFullName(gender), Level = 2 }, new Opponent { Name = names.NextFullName(gender), Level = 2 }, new Opponent { Name = names.NextFullName(gender), Level = 2 }, new Opponent { Name = names.NextFullName(gender), Level = 2 }, new Opponent { Name = names.NextFullName(gender), Level = 2 }, new Opponent { Name = names.NextFullName(gender), Level = 3 }, new Opponent { Name = names.NextFullName(gender), Level = 3 }, new Opponent { Name = names.NextFullName(gender), Level = 3 }, new Opponent { Name = names.NextFullName(gender), Level = 3 }, new Opponent { Name = names.NextFullName(gender), Level = 3 }, new Opponent { Name = names.NextFullName(gender), Level = 4 }, new Opponent { Name = names.NextFullName(gender), Level = 4 }, new Opponent { Name = names.NextFullName(gender), Level = 4 }, new Opponent { Name = names.NextFullName(gender), Level = 4 }, new Opponent { Name = names.NextFullName(gender), Level = 4 }, new Opponent { Name = names.NextFullName(gender), Level = 5 }, new Opponent { Name = names.NextFullName(gender), Level = 5 }, new Opponent { Name = names.NextFullName(gender), Level = 5 }, new Opponent { Name = names.NextFullName(gender), Level = 5 }, new Opponent { Name = names.NextFullName(gender), Level = 5 }, new Opponent { Name = names.NextFullName(gender), Level = 6 }, new Opponent { Name = names.NextFullName(gender), Level = 6 }, new Opponent { Name = names.NextFullName(gender), Level = 6 }, new Opponent { Name = names.NextFullName(gender), Level = 6 }, new Opponent { Name = names.NextFullName(gender), Level = 6 }, new Opponent { Name = names.NextFullName(gender), Level = 7 }, new Opponent { Name = names.NextFullName(gender), Level = 7 }, new Opponent { Name = names.NextFullName(gender), Level = 7 }, new Opponent { Name = names.NextFullName(gender), Level = 7 }, new Opponent { Name = names.NextFullName(gender), Level = 7 }, new Opponent { Name = names.NextFullName(gender), Level = 8 }, new Opponent { Name = names.NextFullName(gender), Level = 8 }, new Opponent { Name = names.NextFullName(gender), Level = 8 }, new Opponent { Name = names.NextFullName(gender), Level = 8 }, new Opponent { Name = names.NextFullName(gender), Level = 8 }, new Opponent { Name = names.NextFullName(gender), Level = 9 }, new Opponent { Name = names.NextFullName(gender), Level = 9 }, new Opponent { Name = names.NextFullName(gender), Level = 9 }, new Opponent { Name = names.NextFullName(gender), Level = 9 }, new Opponent { Name = names.NextFullName(gender), Level = 9 }, new Opponent { Name = names.NextFullName(gender), Level = 10 }, new Opponent { Name = names.NextFullName(gender), Level = 10 }, new Opponent { Name = names.NextFullName(gender), Level = 10 }, new Opponent { Name = names.NextFullName(gender), Level = 10 }, new Opponent { Name = names.NextFullName(gender), Level = 10 }, new Opponent { Name = names.NextFullName(gender), Level = 11 }, new Opponent { Name = names.NextFullName(gender), Level = 11 }, new Opponent { Name = names.NextFullName(gender), Level = 11 }, new Opponent { Name = names.NextFullName(gender), Level = 11 }, new Opponent { Name = names.NextFullName(gender), Level = 11 }, new Opponent { Name = names.NextFullName(gender), Level = 12 }, new Opponent { Name = names.NextFullName(gender), Level = 12 }, new Opponent { Name = names.NextFullName(gender), Level = 12 }, new Opponent { Name = names.NextFullName(gender), Level = 12 }, new Opponent { Name = names.NextFullName(gender), Level = 12 }, new Opponent { Name = names.NextFullName(gender), Level = 13 }, new Opponent { Name = names.NextFullName(gender), Level = 13 }, new Opponent { Name = names.NextFullName(gender), Level = 13 }, new Opponent { Name = names.NextFullName(gender), Level = 13 }, new Opponent { Name = names.NextFullName(gender), Level = 13 }, new Opponent { Name = names.NextFullName(gender), Level = 14 }, new Opponent { Name = names.NextFullName(gender), Level = 14 }, new Opponent { Name = names.NextFullName(gender), Level = 14 }, new Opponent { Name = names.NextFullName(gender), Level = 14 }, new Opponent { Name = names.NextFullName(gender), Level = 14 }, new Opponent { Name = names.NextFullName(gender), Level = 15 }, new Opponent { Name = names.NextFullName(gender), Level = 15 }, new Opponent { Name = names.NextFullName(gender), Level = 15 }, new Opponent { Name = names.NextFullName(gender), Level = 15 }, new Opponent { Name = names.NextFullName(gender), Level = 15 }, new Opponent { Name = names.NextFullName(gender), Level = 16 }, new Opponent { Name = names.NextFullName(gender), Level = 16 }, new Opponent { Name = names.NextFullName(gender), Level = 16 }, new Opponent { Name = names.NextFullName(gender), Level = 16 }, new Opponent { Name = names.NextFullName(gender), Level = 16 }, new Opponent { Name = names.NextFullName(gender), Level = 17 }, new Opponent { Name = names.NextFullName(gender), Level = 17 }, new Opponent { Name = names.NextFullName(gender), Level = 17 }, new Opponent { Name = names.NextFullName(gender), Level = 17 }, new Opponent { Name = names.NextFullName(gender), Level = 17 }, new Opponent { Name = names.NextFullName(gender), Level = 18 }, new Opponent { Name = names.NextFullName(gender), Level = 18 }, new Opponent { Name = names.NextFullName(gender), Level = 18 }, new Opponent { Name = names.NextFullName(gender), Level = 18 }, new Opponent { Name = names.NextFullName(gender), Level = 18 }, new Opponent { Name = names.NextFullName(gender), Level = 19 }, new Opponent { Name = names.NextFullName(gender), Level = 19 }, new Opponent { Name = names.NextFullName(gender), Level = 19 }, new Opponent { Name = names.NextFullName(gender), Level = 19 }, new Opponent { Name = names.NextFullName(gender), Level = 19 }, new Opponent { Name = names.NextFullName(gender), Level = 20 }, new Opponent { Name = names.NextFullName(gender), Level = 20 }, new Opponent { Name = names.NextFullName(gender), Level = 20 }, new Opponent { Name = names.NextFullName(gender), Level = 20 }, new Opponent { Name = names.NextFullName(gender), Level = 20 } ); context.SaveChanges(); } }
public void World() { string[,] map = new string[10, 15]; for (int i = 0; i < 20; i++) { int tempY; int tempX; do { tempY = rng.Next(0, 9); tempX = rng.Next(0, 14); } while (GetPos(tempY, tempX) != " O "); holes.Add(new int[] { tempY, tempX }); } for (int i = 0; i < 8; i++) { int tempY; int tempX; do { tempY = rng.Next(2, 7); tempX = rng.Next(2, 12); } while (GetPos(tempY, tempX) != " O "); chest.Add(new int[] { tempY, tempX }); } for (int i = 0; i < 2; i++) { InfoGenerator names = new InfoGenerator(DateTime.Now.Millisecond); Gender gender = Gender.Any; int tempY; int tempX; do { tempY = rng.Next(2, 7); tempX = rng.Next(2, 12); } while (GetPos(tempY, tempX) != " O "); enemies.Add(new int[] { tempY, tempX }); enemyCharacters.Add(new Enemy(names.NextFirstName(gender))); } bool select = true; while (select) { Console.Write("How many players 1-4?: "); try { string userIn = Console.ReadLine(); int inputInt = Convert.ToInt32(userIn); if (inputInt < 1 || inputInt > 4) { throw new Exception("Too many players or no player."); } int players = 0; for (int i = 0; i < (players = inputInt); i++) { int tempY; int tempX; do { tempY = rng.Next(2, 7); tempX = rng.Next(2, 12); } while (GetPos(tempY, tempX) != " O "); player.Add(new int[] { tempY, tempX }); Console.WriteLine("Name your character."); bool naming = true; string name = Console.ReadLine(); while (naming) { if (name == "")//If no name added to string { Console.Write("\nEnter a name: "); name = Console.ReadLine(); naming = true; } else { playerCharacters.Add(new Character(name)); naming = false; } } } select = false; } catch (FormatException) { Console.WriteLine("Not a number try again."); } catch (Exception ex) { Console.WriteLine(ex.Message); } } int y; int x; for (y = 0; y < 10; y++) { for (x = 0; x < 15; x++) { map[y, x] = GetPos(y, x); // holes , chests , enemies and player. } } for (y = 0; y < 10; y++) { for (x = 0; x < 15; x++) { if (map[y, x] == " O ") { Console.ForegroundColor = ConsoleColor.White; } if (map[y, x] == " X ") { Console.ForegroundColor = ConsoleColor.Black; } if (map[y, x] == " T ") { Console.ForegroundColor = ConsoleColor.Magenta; } if (map[y, x] == " E ") { Console.ForegroundColor = ConsoleColor.Red; } if (map[y, x] == " P1" || map[y, x] == " P2" || map[y, x] == " P3" || map[y, x] == " P4") { Console.ForegroundColor = ConsoleColor.Green; } Console.Write(map[y, x]); } Console.WriteLine("\n"); } }