Exemple #1
0
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime, Celeb celeb, GameplayManager gameplayManager)
        {
            int minutes = (int)(gameplayManager.GetElapsedGameTime() / 60);
            int seconds = (int)(gameplayManager.GetElapsedGameTime() % 60);

            Vector2 uiFontSize = uiFont.MeasureString("Score: {0:00000000}");

            string playTime  = string.Format("Time {0:00}:{1:00}", minutes, seconds);
            string gameScore = string.Format("Score: {0:00000000}", GameState.Score);

            spriteBatch.DrawString(uiFont, playTime, new Vector2(32, 32), Color.OrangeRed);
            spriteBatch.DrawString(uiFont, gameScore, new Vector2((1920 / 2) - (uiFontSize.X / 2), 32), Color.OrangeRed);
            //spriteBatch.DrawString(uiFont, "Lives: " + GameState.Lives, new Vector2(32, 64), Color.White);
        }
        public void update(GameTime gameTime, GraphicsDeviceManager graphics, UI gameUI, Celeb celeb)
        {
            personTimer    += gameTime.ElapsedGameTime.TotalSeconds;
            firstGigaTimer += gameTime.ElapsedGameTime.TotalSeconds;
            if ((GameState.BeatsPerMinute >= 260 && personTimer >= 0.4f) || (GameState.BeatsPerMinute < 260 && personTimer >= 3 - GameState.BeatsPerMinute * 1.0 / 100))
            {
                Person newPerson = makePerson(graphics, GameState.BeatsPerMinute);
                people.Add(makePerson(graphics, GameState.BeatsPerMinute));
                personTimer = 0;
            }

            peopleIndexToDelete = -1;
            foreach (Person p in people)
            {
                p.Update(gameTime);
                if (p.position.X < 0 || p.position.X > 1920)
                {
                    peopleIndexToDelete = people.IndexOf(p);
                }
                if ((p.getCenterX() >= celeb.position.X) && (p.getCenterX() <= celeb.getCenterX() + celeb.texture.Width / 12 / 2))
                {
                    peopleIndexToDelete = people.IndexOf(p);
                    celeb.collision(p.isNoisy());
                }
            }
            if (peopleIndexToDelete != -1)
            {
                people.RemoveAt(peopleIndexToDelete);
            }
        }