예제 #1
0
        public static SuperHero CreateRandom(Random rng)
        {
            // Console.WriteLine("Started the process of creating a random SuperHero!");

            var heroAlias = RandomHeroAlias(rng);

            var hairStyleRNG = rng.Next(0, 4);

            // if RNG lands on either 2 or 3, then it'll be 'Normal'
            HairStyle hairStyle = HairStyle.Normal;


            switch (hairStyleRNG)
            {
            case 0:

                hairStyle = HairStyle.Covered;
                break;

            case 1:

                hairStyle = HairStyle.Radiant;
                break;
            }

            var hero = SuperHero.CreateInstance(heroAlias, hairStyle);

            hero.RealIdentity = RealIdentity.CreateRandom(hero, rng);

            hero.Quotes = Quote.CreateRandom(rng.Next(0, 10), rng, hero);

            // Console.WriteLine("Finalized the creation of a random SuperHero!");

            return(hero);
        }
예제 #2
0
        public static void AddOneSuperHero()
        {
            Console.WriteLine("Creating a new Hero");

            var newHero = SuperHero.CreateInstance("FoxBear");

            using (var context = new SuperHeroDbContext())
            {
                context.SuperHeroes.Add(newHero);
                context.SaveChanges();
            }

            Console.WriteLine("Successfully created a new Hero!");
        }
예제 #3
0
        public static void AddSomeSuperHeroes(int heroAmount)
        {
            Console.WriteLine("Creating some heroes");


            var someNewHeroes = new Domain.SuperHero[heroAmount];

            for (var i = 0; i < heroAmount; i++)
            {
                someNewHeroes[i] = SuperHero.CreateInstance("Hero" + i);
            }

            using (var context = new SuperHeroDbContext())
            {
                context.SuperHeroes.AddRange(someNewHeroes);
                context.SaveChanges();
            }

            Console.WriteLine("Successfully created some new heroes!");
        }
예제 #4
0
        // ReSharper disable once InconsistentNaming
        // ReSharper disable once IdentifierTypo
        public static SuperHero CreateAllMightFromBNHA()
        {
            Console.WriteLine("Starting the creation of All Might!");


            var hero = SuperHero.CreateInstance("All Might", HairStyle.Radiant);

            var realIdentify = RealIdentity.CreateInstance(hero, "Toshinori Yagi");

            var quotes = new Quote[]
            {
                Quote.CreateInstance("The Symbol of Peace", QuoteStyle.Cheesy, hero),
                Quote.CreateInstance("UNITED STATES OF SMASH!", QuoteStyle.Awesome, hero),
                Quote.CreateInstance("Because I am here!", QuoteStyle.Cheesy, hero)
            };

            hero.RealIdentity = realIdentify;
            hero.Quotes       = quotes;

            Console.WriteLine("Sucessfully created All Might!");
            return(hero);
        }