Inheritance: MonoBehaviour
Example #1
0
        public new void Update(GameTime gameTime)
        {
            if (running)
            {
                if (game.HUD.Time >= 240)
                {
                    game.AchiTracker.UnlockSpeedRun();
                }

                if (Position.X < game.Map.Width - 6)
                {
                    mario.Position = new Vector2(Position.X + 0.05f, Position.Y);
                    Game1.Camera.PanCamera(2, game);
                    mario.Update(gameTime);
                }
                else
                {
                    mario.RightReleased();
                    hidden = true;
                }
                if (hidden)
                {
                    ++hiddenInterval;
                }
                if (hiddenInterval == 100)
                {
                    game.WorldLoader.Background.Add(new ToadCastleFlag()
                    {
                        Position = new Vector2(castle.Position.X + 2, 7.5f)
                    });
                }
                if (hiddenInterval > 0 && hiddenInterval % 100 == 0)
                {
                    Fireball fire = new Fireball(game, new Vector2(rnd.Next((int)castle.Position.X - 1, (int)castle.Position.X + 6), rnd.Next(1, 6)), 0)
                    {
                        Interval = 100
                    };
                    game.WorldLoader.Fireballs.Add(fire);
                }

                if (hiddenInterval > 200)
                {
                    if (game.LevelName == "Level1-1")
                    {
                        game.AchiTracker.UpdateAchievement();
                        AchievementScreen.ShowAchievements(game, "Level1-4");
                    }
                }
            }
            else
            {
                Position = new Vector2(Position.X, Position.Y + 0.1f);
                if (Position.Y - Bounds.Y >= 12)
                {
                    Run();
                }
            }
        }
 public static void Update(Game1 game)
 {
     if (showLivesRemaining > 0)
     {
         --showLivesRemaining;
         if (showLivesRemaining == 0)
         {
             AchievementScreen.ShowAchievements(game, "NONE");
         }
     }
 }
 public void Use()
 {
     // game.WorldLoader.LoadWorld("Level1-1", game, false);
     game.AchiTracker.UpdateAchievement();
     AchievementScreen.ShowAchievements(game, "Level1-1");
 }
Example #4
0
 protected override void Awake()
 {
     base.Awake();
     screenDisplay = GetComponent <AchievementScreen>();
     AddFunction(MovingPlayer);
 }
Example #5
0
        public static void UpdateAllWorld(Game1 game, GameTime gameTime)
        {
            Heads_Up_Display.MarioLivesScreen.Update(game);
            AchievementScreen.Update(game);
            foreach (IController controller in game.Controllers)
            {
                controller.Update();
            }

            if (game.IsPaused)
            {
                return;
            }

            game.Map.Update(gameTime);
            game.Mario.Update(gameTime);
            foreach (IItem item in game.WorldLoader.Items)
            {
                item.Update(gameTime);
            }

            foreach (IProjectile fireball in game.WorldLoader.Fireballs)
            {
                fireball.Update(gameTime);
            }

            foreach (IEnemy enemy in game.WorldLoader.Enemies)
            {
                enemy.Update(gameTime);
            }
            foreach (IEnemy enemy in game.WorldLoader.Enemies)
            {
                enemy.FinishDirection();
            }

            {
                bool   addBall = false;
                Lakitu lakitu  = null;
                foreach (IEnemy enemy in game.WorldLoader.Enemies)
                {
                    if (enemy is Lakitu)
                    {
                        lakitu = (Lakitu)enemy;
                        if (lakitu.AboveMario() && lakitu.State.thrown == false)
                        {
                            addBall = true;
                        }
                    }
                }
                if (addBall)
                {
                    game.WorldLoader.Enemies.Add(new LakituBall(game, lakitu.Position, 10));
                    lakitu.State.thrown = true;
                }
            }

            foreach (Pipe pipe in game.WorldLoader.Pipes)
            {
                pipe.Update(gameTime);
            }

            foreach (IBackground background in game.WorldLoader.Background)
            {
                background.Update(gameTime);
            }

            foreach (MovingText movingText in game.WorldLoader.MovingTexts)
            {
                movingText.Update(gameTime);
            }

            game.HUD.Update(gameTime);
        }