Пример #1
0
        static Hero PlayerSetup()
        {
            Console.WriteLine("What is your name?");

            string name   = Console.ReadLine();
            string choice = "0";

            while (choice != "1" && choice != "2" && choice != "3")
            {
                Console.WriteLine("Please type the number of the hero you would ike to be?\n1. Cowboy\n2. Gunslinger\n3. Sheriff");
                choice = Console.ReadLine();
            }

            switch (choice)
            {
            case ("1"):
                Cowboy cowboy = new Cowboy(name);
                return(cowboy);

            case ("2"):
                // Change Ninja to another class of hero.
                Gunslinger gunslinger = new Gunslinger(name);
                return(gunslinger);

            case ("3"):
                // Change Ninja to another class of hero.
                Sheriff sheriff = new Sheriff(name);
                return(sheriff);
            }
            return(null);
        }
Пример #2
0
 private void CheckForStepBelow(Gunslinger gunslinger)
 {
     gunslinger.Ground = null;
     Movement.Move(gunslinger, VerticalDirection.Down, gunslinger.StepHeight);
     foreach (Block block in Map.Blocks)
     {
         if (gunslinger.BottomBounds.Intersects(block.BoundingBox) && block != gunslinger.Ground)
         {
             gunslinger.FixBottomPosition(block);
             return;
         }
     }
     gunslinger.Y = gunslinger.PreviousY;
 }