示例#1
0
        static void doStuff(M9 inputName)
        {
            Console.Write("Your action: ");
            string action = Console.ReadLine();

            if (action == "reload")
            {
                inputName.Reload();
                doStuff(inputName);
            }
            else if (action == "shoot")
            {
                inputName.Shoot();
                doStuff(inputName);
            }
            else if (action == "charge")
            {
                inputName.pullChargingHandle();
                doStuff(inputName);
            }
            else if (action == "return")
            {
                shootingRange();
            }
            else if (action == "clip")
            {
                Console.WriteLine($"You have {inputName.CheckClip()} rounds left in current clip.");
                doStuff(inputName);
            }
            else
            {
                Console.WriteLine("Check your input");
                doStuff(inputName);
            }
        }
示例#2
0
        public void Run()
        {
            var specalist = new Specialist();
            var nco       = new NCO();
            var warrant   = new Warrant();
            var lt        = new LT();
            var co        = new CO();
            var m4        = new M4();
            var m9        = new M9();
            var m320      = new M320();
            var glock     = new Glock();
            var hmmwv     = new HMMWV();
            var wrecker   = new Wrecker();
            var fiveton   = new FiveTon();

            Console.WriteLine("\nThis is a story of a unit going on an exercise to a field location.");
            PrepForTheField(specalist);
            PrepForTheField(nco);
            PrepForTheField(warrant);
            PrepForTheField(lt);
            PrepForTheField(co);

            PrepForTheRange(specalist, m320);
            PrepForTheRange(nco, m4);
            PrepForTheRange(warrant, glock);
            PrepForTheRange(lt, m4);
            PrepForTheRange(co, m9);

            Console.WriteLine($"\nThe Specialits are responsible for driving all vehicles to the field:");
            GoOnMission(specalist, hmmwv);
            Console.WriteLine(" ");
            GoOnMission(specalist, wrecker);
            Console.WriteLine(" ");
            GoOnMission(specalist, fiveton);
        }
示例#3
0
        public static void shootingRange()
        {
            Revolver c1  = new Revolver();
            M9       m9  = new M9();
            M4       m4  = new M4();
            M82      m82 = new M82();

            Console.WriteLine("We currently have revolver, m9(pistol), m4(automatic rifle), m82(semi-auto rifle) or \"leave\"\n\n");
            Console.Write("\tWhich weapon would you like to play with? ");
            string entry = Console.ReadLine();

            if (entry == "m4")
            {
                Console.WriteLine($"the length of barrel is {m4.barrelLength} cm long.");
                Console.WriteLine($"Length of this weapon is {m4.length} cm long.");
                Console.WriteLine($"Weight of this weapon is {m4.weight} grams.");
                Console.WriteLine($"This weapon feeds on {m4.caliber} rounds.");
                Console.WriteLine("Available actions: reload / charge / shoot / clip / return");
                doStuff(m4);
            }
            else if (entry == "m9")
            {
                Console.WriteLine($"the length of barrel is {m9.barrelLength} cm long.");
                Console.WriteLine($"Length of this weapon is {m9.length} cm long.");
                Console.WriteLine($"Weight of this weapon is {m9.weight} grams.");
                Console.WriteLine($"This weapon feeds on {m9.caliber} rounds.");
                Console.WriteLine("Available actions: reload / charge / shoot / clip/ return");
                doStuff(m9);
            }
            else if (entry == "revolver")
            {
                Console.WriteLine($"the length of barrel is {c1.barrelLength} cm long.");
                Console.WriteLine($"Length of this weapon is {c1.length} cm long.");
                Console.WriteLine($"Weight of this weapon is {c1.weight} grams.");
                Console.WriteLine($"This weapon feeds on {c1.caliber} rounds.");
                Console.WriteLine("Available actions: shoot / return");
                doStuff(c1);
            }
            else if (entry == "m82")
            {
                Console.WriteLine($"the length of barrel is {m82.barrelLength} cm long.");
                Console.WriteLine($"Length of this weapon is {m82.length} cm long.");
                Console.WriteLine($"Weight of this weapon is {m82.weight} grams.");
                Console.WriteLine($"This weapon feeds on {m82.caliber} rounds.");
                Console.WriteLine("Available actions: reload / charge / shoot / clip / return");
                doStuff(m82);
            }
            else if (entry == "leave")
            {
            }
            else
            {
                Console.WriteLine("Check your input");
                shootingRange();
            }
        }