示例#1
0
        static void Main(string[] args)
        {
            Bear barryTheBear = new Bear();

            barryTheBear.Weight = 2000;
            barryTheBear.Walks();
            barryTheBear.Speak();
            Console.WriteLine();


            Dog remmi = new Dog();

            remmi.Name    = "Remmy";
            remmi.Weight  = 75;
            remmi.HasEyes = true;
            remmi.Listens();
            remmi.Speak();

            remmi.Walks();


            PolarBear cokeACola = new PolarBear();

            cokeACola.Weight = 2000;


            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            Bear barryTheBear = new Bear();

            barryTheBear.Weight = 2000;


            barryTheBear.Walks();
            barryTheBear.Speak();


            Dog goldieTheDog = new Dog();

            goldieTheDog.Weight  = 100;
            goldieTheDog.Sound   = "bark";
            goldieTheDog.Barking = true;
            goldieTheDog.Bark();
            goldieTheDog.FetchTheBall();

            //since PolarBear is inheriting from Bear it also automatically inherites from Animal class
            PolarBear cokeACola = new PolarBear();


            Console.ReadLine();
        }
示例#3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            BlackBear  blackBear  = new BlackBear();
            Coho       coho       = new Coho();
            GreyWolf   greyWolf   = new GreyWolf();
            LionFish   lionFish   = new LionFish();
            PinkSalmon pinkSalmon = new PinkSalmon();
            PolarBear  polarBear  = new PolarBear();



            Console.WriteLine(polarBear.Swim());
            Console.WriteLine(pinkSalmon.Eat());
            Console.WriteLine(blackBear.Nurse());
            Console.WriteLine(lionFish.Sleep());
            Console.WriteLine(greyWolf.Play());
            Console.WriteLine(coho.Migrate());

            IRun bBear = new BlackBear();

            Console.WriteLine(bBear.TopSpeed);

            Console.WriteLine(greyWolf.Run());
            Console.WriteLine(pinkSalmon.EatsBugs());
            Console.WriteLine(pinkSalmon.favoriteBug);
            Console.WriteLine(blackBear.favoriteBug);
            Console.WriteLine(blackBear.EatsBugs());
        }
示例#4
0
        static void Main(string[] args)
        {
            //Bear barryTheBear = new Bear();
            //barryTheBear.Weight = 2000;

            //barryTheBear.Walks();
            //barryTheBear.Speak();

            //Console.ReadLine();


            Dog airBud = new Dog();

            airBud.IsAGoodBoy = true;
            airBud.Weight     = 44;
            airBud.HasEyes    = true;


            airBud.Beg();

            PolarBear cokeACola   = new PolarBear();
            Animal    theJSWizard = new Animal();

            theJSWizard.NumberOfLegs = 2;
            theJSWizard.HasEyes      = false;

            Console.ReadLine();
        }
示例#5
0
        static void Main(string[] args)
        {
            Bear barryTheBear = new Bear();

            barryTheBear.Weight = 2000;

            Lemur melman = new Lemur();

            melman.Weight       = 25;
            melman.HasFingers   = true;
            melman.NumberOfLegs = 2;

            PolarBear cokeaCola = new PolarBear();
            Animal    theJSWiz  = new Animal();

            theJSWiz.NumberOfLegs = 2;
            theJSWiz.Eyes         = true;



            barryTheBear.Walk();
            barryTheBear.Speak();

            Console.ReadLine();
        }
示例#6
0
 /// <summary>
 /// Creates an array of objects that represent each class that inherits from Bear
 /// </summary>
 /// <returns>Array of classes that inherit from Bear</returns>
 public static Bear[] CreateBears()
 {
     Bear[] bears = new Bear[3];
     bears[0] = new Panda();
     bears[1] = new Grizzly();
     bears[2] = new PolarBear();
     return(bears);
 }
        public void PolarBearInheritsFromMammal()
        {
            // Arrange
            PolarBear whitey = new PolarBear();
            // Act
            bool actual = whitey.IsTamable;

            // Assert
            Assert.True(actual);
        }
示例#8
0
        public void Testing_breed_interface()
        {
            // Arrange
            PolarBear polarBear = new PolarBear();

            // Act
            string result = polarBear.Breed();

            // Assert
            Assert.Equal("The cubs are so cute!!!", result);
        }
示例#9
0
        public void Testing_interface_on_second_class()
        {
            // Arrange
            PolarBear polarBear = new PolarBear();

            // Act
            string result = polarBear.Fly();

            // Assert
            Assert.Equal("Polar bears with wings!", result);
        }
示例#10
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            PolarBear = await _context.PolarBear.FirstOrDefaultAsync(m => m.ID == id);

            if (PolarBear == null)
            {
                return(NotFound());
            }
            return(Page());
        }
示例#11
0
        public FourthQuest()
        {
            Title     = "Avenge the Fallen!";
            Objective = "Slay a polar bear.\n" +
                        "Polar bears exists in the Ice-region.";
            KillObjective = new PolarBear();
            RewardXP      = 250;

            Dialogues.Add("Quest: " + Title + "\n");
            Dialogues.Add(Environment.player.Name + ", it is time.");
            Dialogues.Add("Before we can help you - you need to help us.");
            Dialogues.Add("The rangers found a corpse on their last scouting mission.");
            Dialogues.Add("The wounds imply that this is the work of a creature larger than a human.");
            Dialogues.Add("Our council has evidence enough for us to believe that this corpse is the work of a Polar Bear.");
            Dialogues.Add("Head over to Ice and avenge our fallen one.");
            Dialogues.Add("Go ahead, get going!");
        }
示例#12
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            PolarBear = await _context.PolarBear.FindAsync(id);

            if (PolarBear != null)
            {
                _context.PolarBear.Remove(PolarBear);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
示例#13
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            PolarBear polarbear = new PolarBear();

            polarbear.Sleep();
            Console.WriteLine("yes i do sleep");
            polarbear.Breastfeed();


            pig pig = new pig();

            pig.Eat();
            pig.Sleep();
            pig.hair();
        }
示例#14
0
        static void Main(string[] args)
        {
            Bear barryTheBear = new Bear();

            barryTheBear.Weight = 2000;
            barryTheBear.Walks();
            barryTheBear.Speaks();


            PolarBear CokeACola = new PolarBear();

            Animal theJSWiz = new Animal();

            theJSWiz.NumberOfLegs = 2;


            Console.ReadLine();
        }
示例#15
0
        public void ShouldTestAdapterPatterns()
        {
            //Arrange
            IBear polarBear    = new PolarBear();
            IDog  borderCollie = new BorderCollie();
            IBear dogAdapter   = new DogAdapter(borderCollie);

            string polarBearRoar, borderCollieBark, dogAdapterRoar;

            //Act
            polarBearRoar    = polarBear.Roar;
            borderCollieBark = borderCollie.Bark;
            dogAdapterRoar   = dogAdapter.Roar;

            //Assert
            Assert.IsNotNull(polarBearRoar);
            Assert.AreEqual(borderCollieBark, dogAdapterRoar);
        }
示例#16
0
        static void Main(string[] args)
        {
            Bear barryTheBear = new Bear();

            PolarBear frostyBear = new PolarBear();

            barryTheBear.Weight = 2000;

            Cat cuteKitty = new Cat();

            cuteKitty.NumberOfLegs = 4;

            cuteKitty.DrinksMilk = true;

            barryTheBear.Walks();
            barryTheBear.Speak();

            cuteKitty.Play();
            cuteKitty.Drink();
            Console.ReadLine();
        }
        /// <summary>
        /// Demonstrates OOP Principles in the program using the console.
        /// </summary>
        public static void Examples()
        {
            PolarBear beary = new PolarBear();

            Console.WriteLine("Beary the Polar Bear is part of the Polar Bear class. He is capable of all these things even though all of them were inherited:");
            Console.WriteLine("Sleeping() method output:");
            beary.Sleeping();
            Console.WriteLine("Eating() method output:");
            beary.Eating();
            Console.WriteLine("Living() method output:");
            beary.Living();
            Console.WriteLine("LikeableScale() and PettableScale() method outputs:");
            Console.WriteLine($"Beary has a likeable scale number of {beary.LikeableScale()} and a pettable scale number of {beary.PettableScale()}.");
            Console.WriteLine("");
            Console.WriteLine("To demonstrate an OOP Principle in our code (in this case polymorphism), even though both Dog and Bear share the Eating() method, they have different behaviors because they were overriden in their derived classes:");
            Console.WriteLine("Bear:");
            beary.Eating();
            Dog doggo = new Dog();

            Console.WriteLine("Dog:");
            doggo.Eating();
        }
示例#18
0
文件: Program.cs 项目: mikefili/Zoo
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the Zoo!");

            Cow       cow       = new Cow();
            BlackBear blackbear = new BlackBear();
            PolarBear polarBear = new PolarBear();
            Ostrich   ostrich   = new Ostrich();
            Goose     goose     = new Goose();
            Tortise   tortise   = new Tortise();
            Crocodile crocodile = new Crocodile();

            Console.WriteLine($"Cow: {cow.PlowField()}");
            Console.WriteLine($"Black Bear: {blackbear.ClimbTree()}");
            Console.WriteLine($"Polar Bear: {polarBear.Sleep()}");
            Console.WriteLine($"Polar Bear: {polarBear.Prey}");
            Console.WriteLine($"Polar Bear: {polarBear.HuntingGround()}");
            Console.WriteLine($"Ostrich: {ostrich.Sprint()}");
            Console.WriteLine($"Ostrich: {ostrich.Race()}");
            Console.WriteLine($"Ostrich: When I race, do I wear blinders? {ostrich.WearBlinders}");
            Console.WriteLine($"Goose: {goose.Sound()}");
            Console.WriteLine($"Tortise: {tortise.HideInShell()}");
            Console.WriteLine($"Crocodile: {crocodile.BirdTeethClean()}");
        }
示例#19
0
        static void Main(string[] args)
        {
            ArrayList Animals = new ArrayList();

            // Instatiate animals from concrete classes
            PolarBear      Branson   = new PolarBear("Branson the Polar Bear", "Male");
            BarnOwl        Otah      = new BarnOwl("Otah the Barn Owl", "Female");
            Tiger          Tiaga     = new Tiger("Tiaga the Tiger", "Female");
            BaldEagle      Glory     = new BaldEagle("Glory the Bald Eagle", "Female");
            BoaConstrictor Balthazar = new BoaConstrictor("Balthazar the Boa Constrictor", "Male");

            // Add animals to list
            Animals.Add(Branson);
            Animals.Add(Otah);
            Animals.Add(Tiaga);
            Animals.Add(Glory);
            Animals.Add(Balthazar);

            foreach (Animal animal in Animals) // Have each animal identify itself and then speak
            {
                Console.WriteLine($"{animal.Identity}:");
                animal.Speak();
            }
        }
示例#20
0
        public void Summon(Player player, EntityTypeEnum entityType, bool noAi = true, BlockPos spawnPos = null)
        {
            EntityType petType;

            try
            {
                petType = (EntityType)Enum.Parse(typeof(EntityType), entityType.Value, true);
            }
            catch (ArgumentException e)
            {
                return;
            }

            if (!Enum.IsDefined(typeof(EntityType), petType))
            {
                player.SendMessage("No entity found");
                return;
            }

            var coordinates = player.KnownPosition;

            if (spawnPos != null)
            {
                if (spawnPos.XRelative)
                {
                    coordinates.X += spawnPos.X;
                }
                else
                {
                    coordinates.X = spawnPos.X;
                }

                if (spawnPos.YRelative)
                {
                    coordinates.Y += spawnPos.Y;
                }
                else
                {
                    coordinates.Y = spawnPos.Y;
                }

                if (spawnPos.ZRelative)
                {
                    coordinates.Z += spawnPos.Z;
                }
                else
                {
                    coordinates.Z = spawnPos.Z;
                }
            }

            var world = player.Level;

            Mob    mob    = null;
            Entity entity = null;

            EntityType type = (EntityType)(int)petType;

            switch (type)
            {
            case EntityType.Chicken:
                mob = new Chicken(world);
                break;

            case EntityType.Cow:
                mob = new Cow(world);
                break;

            case EntityType.Pig:
                mob = new Pig(world);
                break;

            case EntityType.Sheep:
                mob = new Sheep(world);
                break;

            case EntityType.Wolf:
                mob = new Wolf(world)
                {
                    Owner = player
                };
                break;

            case EntityType.Villager:
                mob = new Villager(world);
                break;

            case EntityType.MushroomCow:
                mob = new MushroomCow(world);
                break;

            case EntityType.Squid:
                mob = new Squid(world);
                break;

            case EntityType.Rabbit:
                mob = new Rabbit(world);
                break;

            case EntityType.Bat:
                mob = new Bat(world);
                break;

            case EntityType.IronGolem:
                mob = new IronGolem(world);
                break;

            case EntityType.SnowGolem:
                mob = new SnowGolem(world);
                break;

            case EntityType.Ocelot:
                mob = new Ocelot(world);
                break;

            case EntityType.Zombie:
                mob = new Zombie(world);
                break;

            case EntityType.Creeper:
                mob = new Creeper(world);
                break;

            case EntityType.Skeleton:
                mob = new Skeleton(world);
                break;

            case EntityType.Spider:
                mob = new Spider(world);
                break;

            case EntityType.ZombiePigman:
                mob = new ZombiePigman(world);
                break;

            case EntityType.Slime:
                mob = new Slime(world);
                break;

            case EntityType.Enderman:
                mob = new Enderman(world);
                break;

            case EntityType.Silverfish:
                mob = new Silverfish(world);
                break;

            case EntityType.CaveSpider:
                mob = new CaveSpider(world);
                break;

            case EntityType.Ghast:
                mob = new Ghast(world);
                break;

            case EntityType.MagmaCube:
                mob = new MagmaCube(world);
                break;

            case EntityType.Blaze:
                mob = new Blaze(world);
                break;

            case EntityType.ZombieVillager:
                mob = new ZombieVillager(world);
                break;

            case EntityType.Witch:
                mob = new Witch(world);
                break;

            case EntityType.Stray:
                mob = new Stray(world);
                break;

            case EntityType.Husk:
                mob = new Husk(world);
                break;

            case EntityType.WitherSkeleton:
                mob = new WitherSkeleton(world);
                break;

            case EntityType.Guardian:
                mob = new Guardian(world);
                break;

            case EntityType.ElderGuardian:
                mob = new ElderGuardian(world);
                break;

            case EntityType.Horse:
                var random = new Random();
                mob = new Horse(world, random.NextDouble() < 0.10, random);
                break;

            case EntityType.PolarBear:
                mob = new PolarBear(world);
                break;

            case EntityType.Shulker:
                mob = new Shulker(world);
                break;

            case EntityType.Dragon:
                mob = new Dragon(world);
                break;

            case EntityType.SkeletonHorse:
                mob = new SkeletonHorse(world);
                break;

            case EntityType.Wither:
                mob = new Wither(world);
                break;

            case EntityType.Evoker:
                mob = new Evoker(world);
                break;

            case EntityType.Vindicator:
                mob = new Vindicator(world);
                break;

            case EntityType.Vex:
                mob = new Vex(world);
                break;

            case EntityType.Npc:
                if (Config.GetProperty("EnableEdu", false))
                {
                    mob = new Npc(world);
                }
                else
                {
                    mob = new PlayerMob("test", world);
                }
                break;

            case EntityType.Boat:
                entity = new Boat(world);
                break;
            }

            if (mob != null)
            {
                mob.NoAi = noAi;
                var direction = Vector3.Normalize(player.KnownPosition.GetHeadDirection()) * 1.5f;
                mob.KnownPosition = new PlayerLocation(coordinates.X + direction.X, coordinates.Y, coordinates.Z + direction.Z, coordinates.HeadYaw, coordinates.Yaw);
                mob.SpawnEntity();
            }
            else if (entity != null)
            {
                entity.NoAi = noAi;
                var direction = Vector3.Normalize(player.KnownPosition.GetHeadDirection()) * 1.5f;
                entity.KnownPosition = new PlayerLocation(coordinates.X + direction.X, coordinates.Y, coordinates.Z + direction.Z, coordinates.HeadYaw, coordinates.Yaw);
                entity.SpawnEntity();
            }
        }
示例#21
0
        public override void UseItem(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords)
        {
            Log.WarnFormat("Player {0} trying to spawn Mob #{1}.", player.Username, Metadata);

            var coordinates = GetNewCoordinatesFromFace(blockCoordinates, face);

            Mob mob = null;

            EntityType type = (EntityType)Metadata;

            switch (type)
            {
            case EntityType.Chicken:
                mob = new Chicken(world);
                break;

            case EntityType.Cow:
                mob = new Cow(world);
                break;

            case EntityType.Pig:
                mob = new Pig(world);
                break;

            case EntityType.Sheep:
                mob = new Sheep(world);
                break;

            case EntityType.Wolf:
                mob = new Wolf(world)
                {
                    Owner = player
                };
                break;

            case EntityType.Villager:
                mob = new Villager(world);
                break;

            case EntityType.MushroomCow:
                mob = new MushroomCow(world);
                break;

            case EntityType.Squid:
                mob = new Squid(world);
                break;

            case EntityType.Rabbit:
                mob = new Rabbit(world);
                break;

            case EntityType.Bat:
                mob = new Bat(world);
                break;

            case EntityType.IronGolem:
                mob = new IronGolem(world);
                break;

            case EntityType.SnowGolem:
                mob = new SnowGolem(world);
                break;

            case EntityType.Ocelot:
                mob = new Ocelot(world);
                break;

            case EntityType.Zombie:
                mob = new Zombie(world);
                break;

            case EntityType.Creeper:
                mob = new Creeper(world);
                break;

            case EntityType.Skeleton:
                mob = new Skeleton(world);
                break;

            case EntityType.Spider:
                mob = new Spider(world);
                break;

            case EntityType.ZombiePigman:
                mob = new ZombiePigman(world);
                break;

            case EntityType.Slime:
                mob = new Slime(world);
                break;

            case EntityType.Enderman:
                mob = new Enderman(world);
                break;

            case EntityType.Silverfish:
                mob = new Silverfish(world);
                break;

            case EntityType.CaveSpider:
                mob = new CaveSpider(world);
                break;

            case EntityType.Ghast:
                mob = new Ghast(world);
                break;

            case EntityType.MagmaCube:
                mob = new MagmaCube(world);
                break;

            case EntityType.Blaze:
                mob = new Blaze(world);
                break;

            case EntityType.ZombieVillager:
                mob = new ZombieVillager(world);
                break;

            case EntityType.Witch:
                mob = new Witch(world);
                break;

            case EntityType.Stray:
                mob = new Stray(world);
                break;

            case EntityType.Husk:
                mob = new Husk(world);
                break;

            case EntityType.WitherSkeleton:
                mob = new WitherSkeleton(world);
                break;

            case EntityType.Guardian:
                mob = new Guardian(world);
                break;

            case EntityType.ElderGuardian:
                mob = new ElderGuardian(world);
                break;

            case EntityType.Horse:
                mob = new Horse(world);
                break;

            case EntityType.PolarBear:
                mob = new PolarBear(world);
                break;

            case EntityType.Shulker:
                mob = new Shulker(world);
                break;

            case EntityType.Dragon:
                mob = new Dragon(world);
                break;

            case EntityType.SkeletonHorse:
                mob = new SkeletonHorse(world);
                break;

            case EntityType.Wither:
                mob = new Mob(EntityType.Wither, world);
                break;

            case EntityType.Npc:
                mob = new PlayerMob("test", world);
                break;
            }

            if (mob == null)
            {
                return;
            }

            mob.KnownPosition = new PlayerLocation(coordinates.X, coordinates.Y, coordinates.Z);
            mob.SpawnEntity();

            Log.WarnFormat("Player {0} spawned Mob #{1}.", player.Username, Metadata);
        }
示例#22
0
        public static string PolarEats()
        {
            PolarBear pb = new PolarBear();

            return(pb.Eats());
        }
示例#23
0
        public static Entity Create(this EntityType entityType, Level world)
        {
            Entity entity = null;

            switch (entityType)
            {
            case EntityType.None:
                return(null);

            case EntityType.Chicken:
                entity = new Chicken(world);
                break;

            case EntityType.Cow:
                entity = new Cow(world);
                break;

            case EntityType.Pig:
                entity = new Pig(world);
                break;

            case EntityType.Sheep:
                entity = new Sheep(world);
                break;

            case EntityType.Wolf:
                entity = new Wolf(world);
                break;

            case EntityType.Villager:
                entity = new Villager(world);
                break;

            case EntityType.MushroomCow:
                entity = new MushroomCow(world);
                break;

            case EntityType.Squid:
                entity = new Squid(world);
                break;

            case EntityType.Rabbit:
                entity = new Rabbit(world);
                break;

            case EntityType.Bat:
                entity = new Bat(world);
                break;

            case EntityType.IronGolem:
                entity = new IronGolem(world);
                break;

            case EntityType.SnowGolem:
                entity = new SnowGolem(world);
                break;

            case EntityType.Ocelot:
                entity = new Ocelot(world);
                break;

            case EntityType.Zombie:
                entity = new Zombie(world);
                break;

            case EntityType.Creeper:
                entity = new Creeper(world);
                break;

            case EntityType.Skeleton:
                entity = new Skeleton(world);
                break;

            case EntityType.Spider:
                entity = new Spider(world);
                break;

            case EntityType.ZombiePigman:
                entity = new ZombiePigman(world);
                break;

            case EntityType.Slime:
                entity = new Slime(world);
                break;

            case EntityType.Enderman:
                entity = new Enderman(world);
                break;

            case EntityType.Silverfish:
                entity = new Silverfish(world);
                break;

            case EntityType.CaveSpider:
                entity = new CaveSpider(world);
                break;

            case EntityType.Ghast:
                entity = new Ghast(world);
                break;

            case EntityType.MagmaCube:
                entity = new MagmaCube(world);
                break;

            case EntityType.Blaze:
                entity = new Blaze(world);
                break;

            case EntityType.ZombieVillager:
                entity = new ZombieVillager(world);
                break;

            case EntityType.Witch:
                entity = new Witch(world);
                break;

            case EntityType.Stray:
                entity = new Stray(world);
                break;

            case EntityType.Husk:
                entity = new Husk(world);
                break;

            case EntityType.WitherSkeleton:
                entity = new WitherSkeleton(world);
                break;

            case EntityType.Guardian:
                entity = new Guardian(world);
                break;

            case EntityType.ElderGuardian:
                entity = new ElderGuardian(world);
                break;

            case EntityType.Horse:
                var random = new Random();
                entity = new Horse(world, random.NextDouble() < 0.10, random);
                break;

            case EntityType.PolarBear:
                entity = new PolarBear(world);
                break;

            case EntityType.Shulker:
                entity = new Shulker(world);
                break;

            case EntityType.Dragon:
                entity = new Dragon(world);
                break;

            case EntityType.SkeletonHorse:
                entity = new SkeletonHorse(world);
                break;

            case EntityType.Wither:
                entity = new Wither(world);
                break;

            case EntityType.Evoker:
                entity = new Evoker(world);
                break;

            case EntityType.Vindicator:
                entity = new Vindicator(world);
                break;

            case EntityType.Vex:
                entity = new Vex(world);
                break;

            case EntityType.Npc:
                entity = new PlayerMob("test", world);
                break;

            default:
                return(null);
            }

            return(entity);
        }
示例#24
0
        public static bool DoesPolarHunt()
        {
            PolarBear pb = new PolarBear();

            return(pb.Hunts());
        }
示例#25
0
        public static string PolarSwims()
        {
            PolarBear p = new PolarBear();

            return(p.Swim());
        }
示例#26
0
        public static Entity Create(this EntityType entityType, World world)
        {
            Entity entity = null;

            switch (entityType)
            {
            case EntityType.None:
                return(null);

            case EntityType.Chicken:
                entity = new Chicken(world);
                break;

            case EntityType.Cow:
                entity = new Cow(world);
                break;

            case EntityType.Pig:
                entity = new Pig(world);
                break;

            case EntityType.Sheep:
                entity = new Sheep(world);
                break;

            case EntityType.Wolf:
                entity = new Wolf(world);
                break;

            case EntityType.Villager:
                entity = new Villager(world);
                break;

            case EntityType.MushroomCow:
                entity = new Mooshroom(world);
                break;

            case EntityType.Squid:
                entity = new Squid(world);
                break;

            case EntityType.Rabbit:
                entity = new Rabbit(world);
                break;

            case EntityType.Bat:
                entity = new Bat(world);
                break;

            case EntityType.IronGolem:
                entity = new VillagerGolem(world);
                break;

            case EntityType.SnowGolem:
                entity = new Snowman(world);
                break;

            case EntityType.Ocelot:
                entity = new Ocelot(world);
                break;

            case EntityType.Zombie:
                entity = new Zombie(world);
                break;

            case EntityType.Creeper:
                entity = new Creeper(world);
                break;

            case EntityType.Skeleton:
                entity = new Skeleton(world);
                break;

            case EntityType.Spider:
                entity = new Spider(world);
                break;

            case EntityType.ZombiePigman:
                entity = new ZombiePigman(world);
                break;

            case EntityType.Slime:
                entity = new Slime(world);
                break;

            case EntityType.Endermite:
                entity = new Endermite(world);
                break;

            case EntityType.Enderman:
                entity = new Enderman(world);
                break;

            case EntityType.Silverfish:
                entity = new Silverfish(world);
                break;

            case EntityType.CaveSpider:
                entity = new CaveSpider(world);
                break;

            case EntityType.Ghast:
                entity = new Ghast(world);
                break;

            case EntityType.MagmaCube:
                entity = new MagmaCube(world);
                break;

            case EntityType.Blaze:
                entity = new Blaze(world);
                break;

            case EntityType.ZombieVillager:
                entity = new ZombieVillager(world);
                break;

            case EntityType.Witch:
                entity = new Witch(world);
                break;

            case EntityType.Stray:
                entity = new Stray(world);
                break;

            case EntityType.Husk:
                entity = new Husk(world);
                break;

            case EntityType.WitherSkeleton:
                entity = new WitherSkeleton(world);
                break;

            case EntityType.Guardian:
                entity = new Guardian(world);
                break;

            case EntityType.ElderGuardian:
                entity = new ElderGuardian(world);
                break;

            case EntityType.Horse:
                entity = new Horse(world);
                break;

            case EntityType.ZombieHorse:
                entity = new ZombieHorse(world);
                break;

            case EntityType.PolarBear:
                entity = new PolarBear(world);
                break;

            case EntityType.Shulker:
                entity = new Shulker(world);
                break;

            case EntityType.EnderDragon:
                entity = new EnderDragon(world);
                break;

            case EntityType.SkeletonHorse:
                entity = new SkeletonHorse(world);
                break;

            case EntityType.Wither:
                entity = new Wither(world);
                break;

            case EntityType.Evoker:
                entity = new EvocationIllager(world);
                break;

            case EntityType.Vindicator:
                entity = new VindicationIllager(world);
                break;

            case EntityType.Vex:
                entity = new Vex(world);
                break;

            case EntityType.FallingBlock:
                entity = new EntityFallingBlock(world, null);
                break;

            case EntityType.ArmorStand:
                entity = new EntityArmorStand(world, null);
                break;

            case EntityType.Arrow:
                entity = new ArrowEntity(world, null);
                break;

            case EntityType.Item:
                entity = new ItemEntity(world, null);
                break;

            case EntityType.Mooshroom:
                entity = new Mooshroom(world);
                break;

            case EntityType.Snowball:
                entity = new SnowballEntity(world, null);
                break;

            case EntityType.ThrownEgg:
                entity = new EggEntity(world, null);
                break;

            case EntityType.Salmon:
                entity = new Salmon(world);
                break;

            case EntityType.Donkey:
                entity = new Donkey(world);
                break;

            case EntityType.Llama:
                entity = new Llama(world);
                break;

            case EntityType.Mule:
                entity = new Mule(world);
                break;

            case EntityType.Fox:
                entity = new Fox(world);
                break;

            case EntityType.Parrot:
                entity = new Parrot(world);
                break;

            case EntityType.Phantom:
                entity = new Phantom(world);
                break;

            case EntityType.Bee:
                entity = new Bee(world);
                break;

            case EntityType.LlamaSpit:
                entity = new LlamaSpit(world);
                break;

            //case EntityType.Human:
            //entity = new PlayerMob("test", world, );
            //	break;
            default:
                return(null);
            }

            return(entity);
        }
示例#27
0
        public void PolarBearsInheritEat()
        {
            PolarBear newPolarBear = new PolarBear();

            Assert.Equal("Eats Seals", newPolarBear.Eat());
        }
示例#28
0
        public static int PolarClawLength()
        {
            PolarBear pb = new PolarBear();

            return(pb.ClawLength);
        }
示例#29
0
        public override void IncreaseTier()
        {
            base.IncreaseTier();

            List <object> list = new List <object>();
            BaseCreature  c;

            // haven't got a clue if levels are OSI
            switch (this.Tier)
            {
            case 1:
                c = new Crane();
                c.MoveToWorld(new Point3D(4500, 1382, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                break;

            case 2:
                c = new DireWolf();
                c.MoveToWorld(new Point3D(4494, 1370, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                c = new DireWolf();
                c.MoveToWorld(new Point3D(4494, 1360, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                c = new WhiteWolf();
                c.MoveToWorld(new Point3D(4491, 1366, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                c = new WhiteWolf();
                c.MoveToWorld(new Point3D(4497, 1366, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                c = new GreyWolf();
                c.MoveToWorld(new Point3D(4497, 1366, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                break;

            case 3:
                c = new Quagmire();
                c.MoveToWorld(new Point3D(4483, 1392, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                c = new BogThing();
                c.MoveToWorld(new Point3D(4486, 1385, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                c = new PlagueBeast();
                c.MoveToWorld(new Point3D(4486, 1379, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                break;

            case 4:
                c = new PolarBear();
                c.MoveToWorld(new Point3D(4513, 1395, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                c = new PolarBear();
                c.MoveToWorld(new Point3D(4508, 1393, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                break;

            case 5:
                c = new Yamandon();
                c.MoveToWorld(new Point3D(4498, 1393, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                break;

            case 6:
                c = new Changeling();
                c.MoveToWorld(new Point3D(4518, 1358, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                break;

            case 7:
                c = new Wyvern();
                c.MoveToWorld(new Point3D(4512, 1381, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                break;

            case 8:
                c = new Dragon();
                c.MoveToWorld(new Point3D(4511, 1372, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                c = new Drake();
                c.MoveToWorld(new Point3D(4516, 1371, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                break;

            case 9:
                c = new Reptalon();
                c.MoveToWorld(new Point3D(4530, 1387, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                break;

            case 10:
                c = new SilverSteed();
                c.MoveToWorld(new Point3D(4506, 1358, 23), this.Map);
                c.Blessed = true;
                c.Tamable = false;
                list.Add(c);

                /*
                 * c = new Sphynx();
                 * c.MoveToWorld( new Point3D( 4506, 1358, 23 ), Map );
                 * c.Blessed = true;
                 * c.Tamable = false;
                 * list.Add( c );*/

                break;
            }

            if (list.Count > 0)
            {
                this.Tiers.Add(list);
            }
        }
示例#30
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Welcome to my zoo!\n");
            Console.WriteLine("My zoo has an abstract base class called Mammal.\nMammals" +
                              " have 1) an abstract name and 2) an abstract age, and can 1) eat (abstract) and 2) make a sound (virtual).\n");

            Console.WriteLine("\n\nHit <ENTER> to continue.");
            Console.ReadLine();

            //Show info about Bears and demo different Bear subclasses
            Console.WriteLine("The class 'Bear' inherits from Mammal and overrides all properties and methods. Bear additionally" +
                              " adds a virtual property called ClawLength and an abstract method called Hunts().\n");
            Console.WriteLine("There are three Bear descendent classes: Panda, Grizzly, and PolarBear.");
            Console.WriteLine("Pandas, Grizzlies, and PolarBears override all properties and methods of Bear EXCEPT for: ClawLength, Age, and Sound.");
            Bear[] myBears = CreateBears();

            Console.WriteLine("\n\nHit <ENTER> to see a demonstration of each class that inherits from Bear.");
            Console.ReadLine();
            Console.WriteLine("Here's a demonstration of each bear type\n");
            ShowBears(myBears);
            Console.WriteLine("\n\nHit <ENTER> to continue.");
            Console.ReadLine();


            //Instantiate Primates and return collection of primates
            Console.WriteLine("The class 'Primate' inherits from Mammal and overrides all properties and methods. Primate additionally" +
                              " adds a virtual property called HasTail and an virtual method called Hangs().\n");
            Console.WriteLine("There are three Primate descendent classes: Lemur, Chimpanzee, and Proboscis.");
            Console.WriteLine("Lemurs and Proboscii override Name, Eats(), Sound(), while Chimpanzees additionally override HasTail. ");
            Primate[] myPrimates = CreatePrimates();
            Console.WriteLine("\n\nHit <ENTER> to see a demonstration of each class that inherits from Primate.");
            Console.ReadLine();
            Console.WriteLine("Here's a demonstration of each primate type\n");
            ShowPrimates(myPrimates);
            Console.WriteLine("\n\nHit <ENTER> to continue.");
            Console.ReadLine();

            //Show RingTailed
            Console.WriteLine("Additionally, the class RingTailed inherits from Lemur and adds a method called SpendsTime()");
            RingTailed ringTailedLemur = new RingTailed();

            Console.WriteLine($"Name: {ringTailedLemur.Name}");
            Console.WriteLine($"Age: {ringTailedLemur.Age}");
            Console.WriteLine($"Has tail? {ringTailedLemur.HasTail}");
            Console.WriteLine($"Eats: {ringTailedLemur.Eats()}");
            Console.WriteLine($"Sound: {ringTailedLemur.Sound()}");
            Console.WriteLine($"Hangs: {ringTailedLemur.Hangs()}");
            Console.WriteLine($"Spends time: {ringTailedLemur.SpendsTime()}");
            Console.WriteLine();

            //Show Interface Implementation
            Console.WriteLine("Finally, there are two interfaces: ICanSwim and ICanGroom.");
            Console.WriteLine("Chimpanzee implements both, while PolarBear implements ICanSwim");
            Console.WriteLine("\n\nHit <ENTER> to see a demonstration.");
            Console.ReadLine();
            PolarBear  pb = new PolarBear();
            Chimpanzee c  = new Chimpanzee();

            Console.WriteLine($"calling PolarBear.Swim(): {pb.Swim()}");
            Console.WriteLine($"calling PolarBear.DryOff(): {pb.DryOff()}");
            Console.WriteLine($"calling Chimpanzee.Swim(): {c.Swim()}");
            Console.WriteLine($"calling Chimpanzee.DryOff(): {c.DryOff()}");
            Console.WriteLine($"calling Chimpanzee.Groom(): {c.Groom()}");
            Console.WriteLine($"calling Chimpanzee.EatFoundBug: {c.EatFoundBug()}");
        }