Example #1
0
 public Astronaut(string name, string job, AstroHead head, TorsoBase torso, AstroLegs legs)
 {
     Name  = name;
     Job   = job;
     Head  = head;
     Torso = torso;
     Legs  = legs;
 }
Example #2
0
        static void Main(string[] args)
        {
            var head = new AstronautHead
            {
                FacialExpression = "Smiling",
                Color            = LegoColor.Orange,
                EyeColor         = LegoColor.Green,
                Helmeted         = true
            };

            var legs = new AstroLegs
            {
                HasPants = true,
                Shoes    = ShoeType.FlipFlops
            };

            var torso = new AstroTorso
            {
                HandType     = HandType.Baby,
                ChiseledAbs  = true,
                NumberOfArms = 3,
                Shirted      = true,
            };

            var astronaut = new Astronaut("Space Person", "Janitor", head, torso, legs);

            astronaut.DoYourJob();

            var casper = new Ghost("Casper", DateTime.Today)
            {
                Friendly = true,
            };

            casper.Spook();
            casper.Haunt("Whipstaff Manor");
            casper.Spook();

            var fatso = new Ghost("Fatso", new DateTime(1925, 12, 01))
            {
                Friendly = false,
            };

            fatso.Spook();
            fatso.Haunt("Whipstaff Manor");
            fatso.Spook();

            Console.ReadKey();
        }
Example #3
0
        static void Main(string[] args)
        {
            var head = new AstroHead()
            {
                FacialExpression = "Smiling",
                Color            = LegoColor.Yellow,
                EyeColor         = LegoColor.Green,
                Helmeted         = true
            };

            var atorso = new AstroTorso()
            {
                Hands        = HandType.Baby,
                ChiseledAbs  = true,
                HasShirt     = true,
                NumberOfArms = 3
            };

            var dtorso = new DadBodTorso()
            {
                Hands    = HandType.Tentacle,
                HasShirt = true,
                IsHairy  = false
            };

            var legs = new AstroLegs()
            {
                HasPants = true,
                Shoes    = ShoeType.MoonBoots
            };

            var astronaut = new Astronaut("Major Tom", "Janitor", head, dtorso, legs);

            astronaut.Promote();
            astronaut.DoYourJob();

            var casper = new Ghost("Casper", DateTime.Today)
            {
                IsFriendly = true,
                IsVisible  = true,
            };
            var stretch = new Ghost("Stretch", new DateTime(1895, 12, 1))
            {
                IsFriendly = false
            };

            casper.Spook();
            casper.Haunt("Whipstaff Manor");
            casper.Spook();

            var torsos = new List <TorsoBase>();

            torsos.Add(dtorso);
            torsos.Add(atorso);

            foreach (var torso in torsos)
            {
                torso.Breathe();
                torso.Flex();

                switch (torso)
                {
                case DadBodTorso dbod:
                    dbod.ChangeThermostat("Hot");
                    break;
                }
            }

            var colorfulThings = new List <IColorful> {
                dtorso, atorso, new Baby()
            };

            foreach (var colorfulThing in colorfulThings)
            {
                Console.WriteLine(colorfulThing.Color);

                switch (colorfulThing)
                {
                case IMoveable mover:
                    mover.Move(5);
                    break;
                }
            }

            Console.ReadKey();
        }