Ejemplo n.º 1
0
 protected override void Initialize()
 {
     keyboard                   = new KeyboardController();
     gamepad                    = new GamepadController(this);
     camera                     = new Camera(UtilityClass.cameraHeight, UtilityClass.cameraWidth, new Vector2(UtilityClass.zero, UtilityClass.zero));
     pipeTransition             = new PipeTransition();
     skytransition              = new SkyWorldTransition();
     gameover                   = new GameOver(this);
     loader                     = new LevelLoader(UtilityClass.levelFile, camera);
     levelStore                 = new LevelStorage(camera);
     keyNotPressed              = new KeyNotPressed(this);
     fireBallCount              = UtilityClass.fireballLimit;
     iceBallCount               = UtilityClass.iceballLimit;
     pause                      = false;
     canPause                   = true;
     marioPause                 = false;
     stateTransistionPauseTimer = UtilityClass.stateTransistionTimer;
     time = new TimeStat(UtilityClass.LevelStartTime);
     gui  = new GUI();
     StatePuaseAlterationCall.setGame(this);
     AchievementPause.setGame(this);
     achievementManager = new AchievementManager();
     AchievementEventTracker.setManager(achievementManager);
     base.Initialize();
     tester = new TestingClass(this, levelStore);
     tester.runTests();
     AchievementEventTracker.endRunningTesting();
     pole                   = new Pole();
     flag                   = new Flag();
     hitFlagpole            = false;
     levelWon               = false;
     vine_box_hit           = false;
     VineClimbBeginLocation = new Vector2(30, 0);
 }
Ejemplo n.º 2
0
        protected override void Draw(GameTime gameTime)
        {
            if (gameover.returnDeathScreenBool())
            {
                gameover.Draw(this);
            }
            else
            {
                GraphicsDevice.Clear(Color.CornflowerBlue);

                spriteBatch.Begin();

                Rectangle sourceRectangle      = new Rectangle((int)camera.GetPosition().X, (int)camera.GetPosition().Y, UtilityClass.cameraWidth, UtilityClass.cameraHeight);
                Rectangle destinationRectangle = new Rectangle(UtilityClass.zero, UtilityClass.zero, UtilityClass.cameraWidth, UtilityClass.cameraHeight);
                if (mario.GetLocation().X > UtilityClass.deathbackgroundChange && mario.GetLocation().X < UtilityClass.skyworldbackgroundChange)
                {
                    spriteBatch.Draw(deathbackground, destinationRectangle, sourceRectangle, Color.White);
                }
                else if (mario.GetLocation().X > UtilityClass.skyworldbackgroundChange)
                {
                    sourceRectangle = new Rectangle((int)camera.GetPosition().X - UtilityClass.skyworldbackgroundChange, (int)camera.GetPosition().Y, UtilityClass.cameraWidth, UtilityClass.cameraHeight);
                    spriteBatch.Draw(skyworldbackground, destinationRectangle, sourceRectangle, Color.White);
                }
                else if ((int)camera.GetPosition().X < UtilityClass.backgroundChange)
                {
                    spriteBatch.Draw(background, destinationRectangle, sourceRectangle, Color.White);
                }
                else
                {
                    sourceRectangle = new Rectangle((int)camera.GetPosition().X - UtilityClass.backgroundChange, (int)camera.GetPosition().Y, UtilityClass.cameraWidth, UtilityClass.cameraHeight);
                    spriteBatch.Draw(background2, destinationRectangle, sourceRectangle, Color.White);
                }
                spriteBatch.DrawString(font, UtilityClass.GameTimeName + time.FormattedTime(), new Vector2(UtilityClass.timeLocation, UtilityClass.ten), Color.White);
                spriteBatch.DrawString(basicarialfont, UtilityClass.worldLevel, UtilityClass.GUILevelPosition, Color.White);
                gui.DrawPlayGUI(spriteBatch, font);
                levelStore.Draw(mario, spriteBatch, hitFlagpole);

                pole.Draw(spriteBatch, camera.GetPosition());
                flag.Draw(spriteBatch, camera.GetPosition());
                if (skytransition.returnDrawTransition())
                {
                    skytransition.VineMario.Draw(spriteBatch, VineClimbBeginLocation);
                    hitFlagpole = true;
                }
                if (levelWon)
                {
                    AchievementPause.Execute();
                    endMario.Draw(spriteBatch, camera.GetPosition(), font);
                }
                spriteBatch.End();
                base.Draw(gameTime);
            }
            if (pause && !levelWon)
            {
                drawPause();
            }
        }
 public void superMushAchieved()
 {
     if (!superMushAchievement)
     {
         AchievementPause.Execute();
         MessageBox(new IntPtr(0), superMushAchievementString, UtilityClass.earnedAchievementHeader, UtilityClass.zero);
         superMushAchievement = true;
     }
 }
 public void killedEnemyAchieved()
 {
     if (!killingEnemyAchievement)
     {
         AchievementPause.Execute();
         MessageBox(new IntPtr(0), killingEnemyAchievementString, UtilityClass.earnedAchievementHeader, UtilityClass.zero);
         killingEnemyAchievement = true;
     }
 }
 public void oneUpAchieved()
 {
     if (!oneUpAchievement)
     {
         AchievementPause.Execute();
         MessageBox(new IntPtr(0), oneUpAchievementString, UtilityClass.earnedAchievementHeader, UtilityClass.zero);
         oneUpAchievement = true;
     }
 }
 public void questionCoinAchieved()
 {
     if (!questionCoinAchievement)
     {
         AchievementPause.Execute();
         MessageBox(new IntPtr(0), questionCoinAchievementString, UtilityClass.earnedAchievementHeader, UtilityClass.zero);
         questionCoinAchievement = true;
     }
 }
 public void coinDispenserAchieved()
 {
     if (!hiddenDispenserAchievement)
     {
         AchievementPause.Execute();
         MessageBox(new IntPtr(0), hiddenDispenserAchievementString, UtilityClass.earnedAchievementHeader, UtilityClass.zero);
         hiddenDispenserAchievement = true;
     }
 }
 public void smashedBrickAchieved()
 {
     if (!brickSmashedAchievement)
     {
         AchievementPause.Execute();
         MessageBox(new IntPtr(0), brickSmashedAchievementString, UtilityClass.earnedAchievementHeader, UtilityClass.zero);
         brickSmashedAchievement = true;
     }
 }
 public void finishedLevelAchieved()
 {
     if (!levelFinishAchievement)
     {
         AchievementPause.Execute();
         MessageBox(new IntPtr(0), levelFinishAchievementString, UtilityClass.earnedAchievementHeader, UtilityClass.zero);
         levelFinishAchievement = true;
     }
 }
 public void fireFlowerAchieved()
 {
     if (!fireFlowerAchievement)
     {
         AchievementPause.Execute();
         MessageBox(new IntPtr(0), fireFlowerAchievementString, UtilityClass.earnedAchievementHeader, UtilityClass.zero);
         fireFlowerAchievement = true;
     }
 }