Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            var head = new ZoeHead
            {
                FacialExpression = "Smiling",
                Color            = LegoColor.Orange,
                EyeColor         = LegoColor.Green,
                Helmeted         = true
            };

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

            var atorso = new DadBodTorso
            {
                HandType    = HandType.Baby,
                ChiseledAbs = true,
                Shirted     = true
            };

            var dtorso = new AstronautTorso
            {
                HandType    = HandType.Baby,
                ChiseledAbs = true,
                Shirted     = true
            };

            atorso.Breathe();
            dtorso.Breathe();
            atorso.HandType    = HandType.Baby;
            dtorso.ChiseledAbs = false;



            var astronaut  = new Astronaut("Space Person", "Janitor", head, atorso, legs);
            var astronaut2 = new Astronaut("Space Lady", "Janitor", head, dtorso, legs);

            astronaut.DoYourJob(100);

            var casper = new Ghost("Casper", DateTime.Today);

            casper.Friendly = true;
            casper.Haunt("The Hood");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var head = new ZoeHead
            {
                FacialExpression = "Smiling",
                Color            = LegoColor.Orange,
                EyeColor         = LegoColor.Green,
                Helmeted         = true
            };

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

            var dtorso = new DadBodTorso
            {
                HandType    = HandType.Baby,
                ChiseledAbs = true,
                Shirted     = true
            };

            var atorso = new AstronautTorso()
            {
                HandType    = HandType.Baby,
                ChiseledAbs = true,
                Shirted     = true
            };


            atorso.Breathe();
            dtorso.Breathe();
            atorso.HandType    = HandType.Baby;
            dtorso.ChiseledAbs = false;
            // creates a new instance of the Astronaut class and we ae storing a reference to where that instance lives inside this variable. What part of the Astronaut class? the CONSTRUCTOR
            var astronaut  = new Astronaut("Space Person", "Janitor", head, atorso, legs);
            var astronaut2 = new Astronaut("Space Lady", "Janitor", head, dtorso, legs);

            astronaut2.DoYourJob(100);

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

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


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


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


            var torsos = new List <TorsoBase> {
                dtorso, atorso, new DadBodTorso()
            };

            foreach (var torso in torsos)
            {
                torso.Breathe();
                torso.Flex();
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            // instantiate
            var head = new ZoeHead
            {
                FacialExpression = "Smiling",
                Color            = LegoColor.Orange,
                EyeColor         = LegoColor.Green,
                Helmeted         = true
            };

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

            var dtorso = new DadBodTorso
            {
                HandType    = HandType.Baby,
                ChiseledAbs = true,
                Shirted     = true
            };

            var atorso = new AstronautTorso
            {
                HandType    = HandType.Baby,
                ChiseledAbs = true,
                Shirted     = true
            };

            atorso.Breathe();
            dtorso.Breathe();

            var astronaut  = new Astronaut("Space Person", "Janitor", head, atorso, legs);
            var astronaut2 = new Astronaut("Space Lady", "Janitor", head, dtorso, legs);

            astronaut.DoYourJob(100);

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

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

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


            var torsos = new List <TorsoBase>();

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

            foreach (var torso in torsos)
            {
                torso.Breathe();
                torso.Flex();
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            var head = new ZoeHead
            {
                FacialExpression = "Smiling",
                Color            = LegoColor.Orange,
                EyeColor         = LegoColor.Green,
                Helmeted         = true
            };

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

            var dtorso = new DadBodTorso
            {
                HandType    = HandType.Baby,
                ChiseledAbs = true,
                Shirted     = true
            };

            var atorso = new AstronautTorso()
            {
                HandType    = HandType.Baby,
                ChiseledAbs = true,
                Shirted     = true
            };


            atorso.Breathe();
            dtorso.Breathe();
            atorso.HandType    = HandType.Baby;
            dtorso.ChiseledAbs = false;

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

            // var astronaut2 = new Astronaut("Space Lady", "Janitor", head, dtorso, legs);

            astronaut.DoYourJob(100);

            var casper = new Ghost("Casper", DateTime.Today)
                         // line 15 can also be stated with curly brackets, which would be called an object initializer
            {
                Friendly = true
            };

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

            var fatso = new Ghost("Fatso", new DateTime(1924, 12, 1))
                        // line 15 can also be stated with curly brackets, which would be called an object initializer
            {
                Friendly = false
            };

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

            var torsos = new List <TorsoBase> {
                dtorso, atorso, new DadBodTorso()
            };

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

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

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

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

                switch (colorfulThing)
                {
                case IMoveable mover:
                    mover.Move(5);
                    break;
                }
            }
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            var head = new ZoeHead()
            {
                FacialExpression = "smiling",
                Color            = LegoColor.Orange,
                Helmeted         = true
            };

            var atorso = new AstronautTorso()
            {
                Shirted       = true,
                ChiseledAbs   = false,
                HandType      = HandType.BabyHands,
                NumberOfHands = 3
            };

            var dtorso = new DadBodTorso()
            {
                Shirted     = true,
                ChiseledAbs = false,
                HandType    = HandType.BabyHands
            };

            var legs = new AstronautLegs()
            {
                HasPants = true,
                Shoes    = ShoeType.FlipFlops
            };

            atorso.Breathe();
            dtorso.Breathe();


            var astronaut  = new Astronaut("Space Force Bill", "Janitor", head, dtorso, legs);
            var astronaut2 = new Astronaut("Space Force Jill", "Space Welder", head, atorso, legs);


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


            var casper = new Ghost("Capser", DateTime.Today)
            { // object initializer
                Friendly  = true,
                IsVisible = true
            };

            casper.Spook(); // does nothing because of return and Haunt not being set.
            casper.Haunt("Whipstaff Manor");
            casper.Spook();

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

            fatso.Spook(); // does nothing because of return and Haunt not being set.
            fatso.Haunt("Whipstaff Manor");
            fatso.Spook();

            var torsos = new List <TorsoBase>()
            {
                dtorso, atorso
            };

            //torsos.Add(atorso);

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

            Console.ReadKey();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            var head = new ZoeHead
            {
                FacialExpression = "smiling",
                Color            = LegoColor.Orange,
                Helmeted         = true,
            };

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

            var atorso = new AstronautTorso
            {
                HandType     = HandType.Baby,
                ChiseledAbs  = true,
                NumberOfArms = 3,
                Shirted      = true,
            };

            var dtorso = new DadBodTorso();

            var astronaut  = new Astronaut("Space Person", "Janitor", head, atorso, legs);
            var astronaut2 = new Astronaut("Space Person", "Janitor", head, dtorso, legs);

            astronaut.DoYourJob();
            astronaut2.DoYourJob();

            var casper = new Ghost("Casper", DateTime.Today);

            casper.Friendly = true;

            var fatso = new Ghost("fatso", new DateTime(1924, 12, 1));

            fatso.Friendly = false;

            casper.Haunt("Whipstaff Manor");

            casper.Spook();

            atorso.Breathe();
            dtorso.Breathe();

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

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

                switch (colorfulThing)
                {
                case IMoveable mover:
                    mover.Move(5);
                    break;
                }
            }
            Console.ReadLine();
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            var head = new AstronautHead
            {
                FacialExpression = "Smiling",
                Color            = LegoColor.Orange,
                EyeColor         = LegoColor.Green,
                Helmeted         = true
            };

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

            var dtorso = new DadBodTorso
            {
                HandType    = HandType.Baby,
                ChiseledAbs = true,
                Shirted     = true
            };

            var atorso = new AstronautTorso
            {
                HandType     = HandType.Baby,
                ChiseledAbs  = true,
                NumberofArms = 3,
                Shirted      = true
            };

            atorso.Breathe();
            dtorso.Breathe();
            atorso.HandType    = HandType.Baby;
            dtorso.ChiseledAbs = false;

            var astronaut  = new Astronaut("Space Dude", "Janitor", head, torso, legs);
            var astronaut2 = new Astronaut("Space Lady", "Janitor", head, torso, legs);

            astronaut.DoYourJob(55);

            var casper = new Ghost("Casper", DateTime.Today);

            casper.Friendly = true;
            //OR
            //{
            //    Friendly = true;
            //}
            casper.Spook();
            casper.Haunt("Whipstaff Manor");
            casper.Spook();

            var fatso = new Ghost("Fatso", new DateTime(1924, 12, 1));

            fatso.Friendly = false;

            fatso.Spook();
            fatso.Haunt("Your House");
            fatso.Spook();

            var torsos = new List <TorsoBase> {
                dtorso, atorso, new DadBodTorso()
            };

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

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

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

            Console.ReadKey();
        }