상속: UnrealBuildTool.ModuleRules
예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Rock Paper Scissors!");

            Console.Write("\nEnter your name: ");
            string name    = Console.ReadLine();
            bool   playing = true;

            while (playing)
            {
                Console.Write("would you like to play against Gozilla or Kong? (g/k)?: ");
                string play = Console.ReadLine();
                if (play == "g")
                {
                    MechaGodzilla mecha = new MechaGodzilla();
                    Roshambo      mchoice;
                    mchoice = mecha.GenerateRoshambo();
                    Godzilla god = new Godzilla();
                    Roshambo gchoice;
                    gchoice = god.GenerateRoshambo();
                    //Console.WriteLine(Play(mecha, god));
                    Console.WriteLine($"{Play(mecha, god)} is the winner");
                    Console.Write("play again? (y/n): ");
                    string end = Console.ReadLine();
                    if (end == "y")
                    {
                    }
                    else
                    {
                        playing = false;
                    }
                }
                else if (play == "k")
                {
                    MechaGodzilla mecha = new MechaGodzilla();
                    Roshambo      mchoice;
                    mchoice = mecha.GenerateRoshambo();
                    Kong     king = new Kong();
                    Roshambo kchoice;
                    kchoice = king.GenerateRoshambo();
                    Console.WriteLine($"{Play(mecha, king)} is the winner");
                    Console.Write("play again? (y/n): ");
                    string end = Console.ReadLine();
                    if (end == "y")
                    {
                    }
                    else
                    {
                        playing = false;
                    }
                }
                else
                {
                    Console.WriteLine("that is not a valid choice.");
                }
            }
        }
예제 #2
0
 static Winner Play(MechaGodzilla left, Godzilla right)
 {
     if (left.Choice == right.Choice)
     {
         return(Winner.draw);
     }
     if (left.Choice == Roshambo.Rock && right.Choice == Roshambo.Paper)
     {
         return(Winner.right);
     }
     else
     {
         return(Winner.left);
     }
 }
        /// <summary>
        /// Godzilla is created in the world(mainscreen)
        /// </summary>
        public void CreateGodzilla()
        {
            if (godzilla == null)
            {
                // Create the factory to create cleaners
                IFactory     locationTypeFactory = Factory.AbstractFactory.Instance().Create("MovableCreatures");
                LocationType biggest             = hotel.Facilities.Aggregate((i1, i2) => i1.Position.Y > i2.Position.Y ? i1 : i2);

                // The information godzilla needs to set his values
                //MovableParam initialiseParam = new MovableParam() { height = this.Height / 100 * 80, width = this.Width / 100 * 50, hotel = hotel };
                MovableParam initialiseParam = new MovableParam()
                {
                    Height = ((this.Height / 100) * 80), Width = ((this.Width / 100) * 50), Hotel = hotel, Settings = this.hte
                };

                // Create two cleaners based on the string
                godzilla = locationTypeFactory.CreateMovableCreatures("Godzilla", initialiseParam) as Godzilla;
            }
        }