Exemplo n.º 1
0
        public override void Update()
        {
            // Title
            if (titleSizeFlip)
            {
                if (titleSize > 1f)
                {
                    titleSize -= 0.0007f;
                }
                else
                {
                    titleSize = MathHelper.Lerp(titleSize, 0.9f, 0.009f);
                }
                if (titleSize < 0.91f)
                {
                    titleSizeFlip = !titleSizeFlip;
                }
            }
            else
            {
                if (titleSize < 1f)
                {
                    titleSize += 0.0007f;
                }
                else
                {
                    titleSize = MathHelper.Lerp(titleSize, 1.1f, 0.009f);
                }
                if (titleSize > 1.09f)
                {
                    titleSizeFlip = !titleSizeFlip;
                }
            }

            Start.Update();
            if (Start.Press())
            {
                SceneManager.ChangeScene(SceneManager.shipSelectScene);
                SceneManager.mapScene.NewItems.Flash = -1;
                SceneManager.mapScene.NewRank.Flash  = -1;
                SoundManager.ChangeMusic(SoundManager.map);
            }

            if (SceneManager.started)
            {
                Continue.Update();
                if (Continue.Press())
                {
                    SceneManager.ChangeScene(SceneManager.mapScene);
                    SoundManager.ChangeMusic(SoundManager.map);
                }
            }

            Options.Update();
            if (Options.Press())
            {
                SceneManager.ChangeScene(SceneManager.optionsScene);
            }

            Quit.Update();
            if (Quit.Press())
            {
                Game1.Quit();
            }

            // Rocks
            Score = MathHelper.Lerp(Score, LerpScore, 0.05f);

            if (Globals.Randomizer.Next(0, 101) < 2)
            {
                GameObjects.Add(new MenuRock());
            }

            foreach (GameObject go in GameObjects)
            {
                go.Update();
            }

            for (int i = GameObjects.Count - 1; i >= 0; i--)
            {
                if (GameObjects[i].Dead)
                {
                    if (GameObjects[i].GetType().Name == "MenuRock")
                    {
                        MenuRock rock = (MenuRock)GameObjects[i];
                        if (rock.MouseKill)
                        {
                            LerpScore += 100;
                            for (int j = 0; j < Globals.Randomizer.Next(5, 8); j++)
                            {
                                GameObjects.Add(new Piece(GameObjects[i].Position, GameObjects[i].Texture, 60, 1));
                            }
                        }
                    }
                    GameObjects.RemoveAt(i);
                }
            }
        }