public static void enterMissionMode()
        {
            pointsWorth = 0;             //reset the point value
            if (!Options.isDemo)
            {
                readFromFile();
            }

            bool rComplete = (Options.loadedFromMainMenu) ? true : (racingScore >= passingRacingScore);
            bool dComplete = (Options.loadedFromMainMenu) ? true : (deathMatchScore >= passingDeathMatchScore);

            if (!Options.loadedFromMainMenu)
            {
                Common.playUntilKeyPress(DSound.SoundPath + "\\mi1.ogg", 0);
            }
            if (!dComplete)
            {
                Common.playUntilKeyPress(DSound.SoundPath + "\\ri.ogg", 0);
            }
            if (!Options.loadedFromMainMenu && dComplete)
            {
                Common.playUntilKeyPress(DSound.SoundPath + "\\mi2.ogg", 0);
            }

            Options.mode = getCurrentMode();
            if (Options.loadedFromMainMenu)
            {
                return;
            }
            if (Options.mode == Options.Modes.mission)
            {
                Common.mainGUI.startWaitCursor();
                Holder       h = Interaction.holderAt(0);
                Instructions i = null;

                MissionObjectBase MOB = null;
                int j = 0;
                refueler = new MidAirRefueler(200.0, 200.0);
                carrier  = new AircraftCarrier(200.0, 200.0);
                h.add(refueler);
                h.add(carrier);
                for (j = 40; j <= 50; j += 5)
                {
                    MOB = new SAM(40.0, j);
                    h.add(MOB);
                }
                MOB = new SAM(100.0, 110.0);
                h.add(MOB);

                MOB = new SAM(100.0, 115.0);
                h.add(MOB);

                MOB = new SAM(110.0, 120.0);
                h.add(MOB);

                MOB = new SAM(120.0, 115.0);
                h.add(MOB);

                for (j = 170; j <= 190; j += 10)
                {
                    int k = 0;
                    for (k = 160; k <= 180; k += 10)
                    {
                        MOB = new SAM(j, k);
                        h.add(MOB);
                    }
                }


                i = new Instructions();
                i.addNode(true, 20, 20);
                i.addNode(true, 20, 0);
                i.addNode(true, 0, 20);
                i.addNode(true, 15, 15);
                MOB = new BattleShip(20.0, 20.0, i);
                h.add(MOB);
                MOB = new Island(110.0, 110.0);
                h.add(MOB);
                island = MOB;

                h.add(new GuardTower(110, 110));
                ////southwest corner
                h.add(new GuardTower(160, 110));
                ////south edge middle
                h.add(new GuardTower(200, 110));
                h.add(new GuardTower(110, 210));
                h.add(new GuardTower(160, 210));
                h.add(new GuardTower(210, 210));
                h.add(new GuardTower(110, 310));
                h.add(new GuardTower(160, 310));
                h.add(new GuardTower(210, 310));

                MOB = new TrainingCamp(120, 190);
                //west coast of island, sector m19
                MOB.setAttributes(true, false);
                h.add(MOB);
                //Set up defenses around training grounds
                h.add(new GuardTower(120, 188));
                h.add(new GuardTower(120, 192));
                h.add(new GuardTower(122, 190));
                h.add(new GuardTower(118, 190));

                //set up defenses:
                //to left and right we will have sams,
                //while to northwest and southeast corners will be guard towers.
                h.add(new SAM(113, 210));
                h.add(new SAM(111, 210));
                h.add(new GuardTower(111, 209));
                h.add(new GuardTower(113, 212));

                h.add(new GuardTower(302, 190));
                h.add(new GuardTower(306, 190));
                h.add(new GuardTower(310, 190));
                h.add(new GuardTower(308, 192));
                i = new Instructions();
                i.addNode(true, 306, 190);
                i.addNode(true, 310, 192);
                i.addNode(true, 308, 188);
                h.add(new Tank(308, 190, i));
                i = new Instructions();
                i.addNode(true, 206, 210);
                i.addNode(true, 206, 212);
                i.addNode(true, 214, 210);
                i.addNode(true, 211, 208);
                h.add(new Tank(211, 210, i));

                h.add(new SAM(210, 275));
                h.add(new SAM(210, 285));
                i = new Instructions();
                i.addNode(true, 215, 281);
                i.addNode(true, 208, 279);
                h.add(new Tank(210, 280, i));
                i = new Instructions();
                i.addNode(true, 205, 290);
                i.addNode(true, 215, 290);
                i.addNode(true, 205, 270);
                i.addNode(true, 215, 270);
                h.add(new Tank(210, 280, i));

                //h.add(new RadarTower(208, 278, true));
                //h.add(new RadarTower(208, 282, true));
                Common.mainGUI.stopWaitCursor();
            }             //if mission
        }
 public static MissionObjectBase createNewObject(String name)
 {
     if (name.Equals("ab"))
     {
         return(new AirBase());
     }
     else if (name.Equals("ac"))
     {
         return(carrier = new AircraftCarrier());
     }
     else if (name.Equals("bs"))
     {
         return(new BattleShip());
     }
     else if (name.Equals("b"))
     {
         return(new Bridge());
     }
     else if (name.Equals("c"))
     {
         return(new Chopper());
     }
     else if (name.Equals("f1"))
     {
         return(new Aircraft());
     }
     else if (name.Equals("gt"))
     {
         return(new GuardTower());
     }
     else if (name.Equals("i"))
     {
         return(island = new Island());
     }
     else if (name.Equals("db"))
     {
         return(darkBlaze = new JuliusAircraft());
     }
     else if (name.Equals("r"))
     {
         return(refueler = new MidAirRefueler());
     }
     else if (name.Equals("pp"))
     {
         return(new PowerPlant());
     }
     else if (name.Equals("rs"))
     {
         return(new RadarTower());
     }
     else if (name.Equals("sb"))
     {
         return(new SAM());
     }
     else if (name.Equals("t"))
     {
         return(new Tank());
     }
     else if (name.Equals("tg"))
     {
         return(new TrainingCamp());
     }
     else if (name.Equals("o"))
     {
         return(player = new Aircraft(false));                //create player
     }
     else if (name.Equals("lb"))
     {
         return(landingBeacon = new LandingBeacon());
     }
     else
     {
         return(null);
     }
 }
Example #3
0
 public static MissionObjectBase createNewObject(String name)
 {
     if (name.Equals("ab"))
     {
         return(new AirBase());
     }
     else if (name.Equals("ac"))
     {
         return(carrier = new AircraftCarrier());
     }
     else if (name.Equals("bs"))
     {
         return(new BattleShip());
     }
     else if (name.Equals("b"))
     {
         return(new Bridge());
     }
     else if (name.Equals("c"))
     {
         return(new Chopper());
     }
     else if (name.StartsWith("f") && name.Length == 2)             // f1 to fn (single digit)
     {
         return(new Aircraft(name));
     }
     else if (name.Equals("gt"))
     {
         return(new GuardTower());
     }
     else if (name.Equals("i"))
     {
         return(island = new Island());
     }
     else if (name.Equals("db"))
     {
         return(darkBlaze = new JuliusAircraft());
     }
     else if (name.Equals("r"))
     {
         return(refueler = new MidAirRefueler());
     }
     else if (name.Equals("pp"))
     {
         return(new PowerPlant());
     }
     else if (name.Equals("rs"))
     {
         return(new RadarTower());
     }
     else if (name.Equals("sb"))
     {
         return(new SAM());
     }
     else if (name.Equals("t"))
     {
         return(new Tank());
     }
     else if (name.Equals("tg"))
     {
         return(new TrainingCamp());
     }
     else if (name.Equals("o"))
     {
         return(player = new Aircraft(false));                //create player
     }
     else if (name.Equals("lb"))
     {
         return(landingBeacon = new LandingBeacon());
     }
     throw new ArgumentException($"The string {name} is not a valid object name.");
 }