示例#1
0
        private void InitLevel(int level)
        {
            switch (level)
            {
            case 1:
                Level1.InitIntro(animationService, introspeedincrease);
                canmorph = false;
                break;

            case 2:
                Level2.InitIntro(animationService, introspeedincrease);
                canmorph = false;
                break;

            case 3:     //challenge
                Level3.InitIntro(animationService, -2);
                break;

            case 4:
                Level4.InitIntro(animationService, introspeedincrease);
                maxwaittimebetweendives = 4000;
                canmorph = true;
                break;

            case 5:
                Level5.InitIntro(animationService, introspeedincrease);
                maxwaittimebetweendives = 3000;
                divespeedincrease       = 1;
                missileincrease         = 1;
                canmorph = true;
                break;

            case 6:
                Level6.InitIntro(animationService, introspeedincrease);
                maxwaittimebetweendives = 2500;
                divespeedincrease       = 1;
                missileincrease         = 1;
                introspeedincrease      = 1;
                canmorph = true;
                break;

            case 7:     //challenge
                Level8.InitIntro(animationService, -2);
                break;

            case 8:
                Level7.InitIntro(animationService, introspeedincrease);
                maxwaittimebetweendives = 2500;
                divespeedincrease       = 1;
                missileincrease         = 2;
                introspeedincrease      = 1;
                canmorph = true;
                break;

            case 9:
                Level9.InitIntro(animationService, introspeedincrease);
                maxwaittimebetweendives = 2000;
                divespeedincrease       = 2;
                missileincrease         = 2;
                introspeedincrease      = 1;
                canmorph = true;
                break;

            case 10:
                Level10.InitIntro(animationService, introspeedincrease);
                maxwaittimebetweendives = 1500;
                divespeedincrease       = 1;
                missileincrease         = 3;
                introspeedincrease      = 2;
                canmorph = false;
                break;

            case 11:     //challenge
                Level11.InitIntro(animationService, -3);
                break;
            }

            GetBugs().ForEach(a => {
                a.Paths.ForEach(p => {
                    if (p.IsIntroPath)
                    {
                        a.PathPoints.AddRange(animationService.ComputePathPoints(p, false, 20));
                    }
                    else
                    {
                        a.PathPoints.AddRange(animationService.ComputePathPoints(p, false));
                    }
                });
            });

            ////draw path logic for debugging only
            //var drawpathbug1 = GetBugs().FirstOrDefault(a => a.Intro is Challenge3);
            //var drawpathbug2 = GetBugs().FirstOrDefault(a => a.Intro is Challenge4);

            //drawpathbug1.DrawPath = true;
            //drawpathbug1.DrawControlLines = true;

            //drawpathbug2.DrawPath = true;
            //drawpathbug2.DrawControlLines = true;

            //drawpathbug2.Paths.ForEach(a =>
            //{
            //    a.OutPutDebug = true;
            //    a.DrawPath = true;
            //});
            ////end draw path debugging logic

            GetBugs().Where(a => a.Wave == 1).ToList().ForEach(a => a.Started = true);

            AIManager.aidodgeing = false;
        }
示例#2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            LEVEL_WIDTH  = GraphicsDevice.DisplayMode.Width / 2;
            LEVEL_HEIGHT = GraphicsDevice.DisplayMode.Height / 2;
            graphics.PreferredBackBufferWidth  = LEVEL_WIDTH;
            graphics.PreferredBackBufferHeight = LEVEL_HEIGHT;
            graphics.ApplyChanges();
            this.rodStewart    = Content.Load <Song>("song");
            this.sunshine      = Content.Load <Song>("Sunshine");
            MediaPlayer.Volume = 0.1f;
            MediaPlayer.Play(rodStewart);
            MediaPlayer.IsRepeating = false;
            textStillToType         = true;

            this.level3Sound    = Content.Load <SoundEffect>("lolSoundEffect");
            level3Inst          = this.level3Sound.CreateInstance();
            level3Inst.IsLooped = false;

            this.level7Bus      = Content.Load <SoundEffect>("BusSound");
            level7Inst          = this.level7Bus.CreateInstance();
            level7Inst.IsLooped = true;

            this.typingSound    = Content.Load <SoundEffect>("Keyboard");
            typingInst          = this.typingSound.CreateInstance();
            typingInst.IsLooped = true;

            SoundEffect.MasterVolume = 0.15f;

            // TODO: Add your initialization logic here
            levelNumber = 9;


            levelOne              = new Level1();
            levelOne.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelOne.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelOne.Initialize();


            levelTwo              = new Level2();
            levelTwo.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelTwo.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelTwo.Initialize();

            levelThree              = new Level3();
            levelThree.convoNumber  = 1;
            levelThree.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelThree.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelThree.Initialize();


            levelFour              = new Level4();
            levelFour.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelFour.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelFour.Initialize();

            levelFive              = new Level5();
            levelFive.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelFive.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelFive.Initialize();

            levelSix              = new Level6();
            levelSix.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelSix.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelSix.Initialize();

            levelSeven              = new Level7();
            levelSeven.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelSeven.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelSeven.Initialize();

            levelEight              = new Level8();
            levelEight.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelEight.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelEight.Initialize();

            levelNine              = new Level9();
            levelNine.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelNine.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelNine.Initialize();

            levelTen              = new Level10();
            levelTen.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelTen.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelTen.Initialize();

            levelEle              = new Level11();
            levelEle.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelEle.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelEle.Initialize();


            levelTwe              = new Level12();
            levelTwe.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelTwe.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelTwe.Initialize();

            levelTteen              = new Level13();
            levelTteen.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelTteen.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelTteen.Initialize();

            levelFourteen              = new Level14();
            levelFourteen.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelFourteen.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelFourteen.Initialize();

            levelFifteen              = new Level15();
            levelFifteen.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelFifteen.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelFifteen.Initialize();

            levelSixteen              = new Level16();
            levelSixteen.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelSixteen.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelSixteen.Initialize();

            levelSeventeen              = new Level17();
            levelSeventeen.LEVEL_WIDTH  = LEVEL_WIDTH;
            levelSeventeen.LEVEL_HEIGHT = LEVEL_HEIGHT;
            levelSeventeen.Initialize();



            transition        = false;
            levelProgressBBox = new Rectangle(LEVEL_WIDTH - 140, 0, 140, LEVEL_HEIGHT);
            transitionPos     = new Vector2(0, 0);

            base.Initialize();
        }