コード例 #1
0
        internal void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            screenBkg.Draw(spriteBatch, gameTime);

            //menubar
            //  Texture2D outlineBkg = new Texture2D()
            upgradeBarBkg.Draw(spriteBatch, gameTime);
            outlineBkg.Draw(spriteBatch, gameTime);
            //currency
            string word = "Currency: " + Resource;

            spriteBatch.DrawOutlinedString(3, new Color(32, 32, 32), DrawHelper.UPGRADEFONT, word,
                                           DrawHelper.CenteredWordPosition(word, DrawHelper.UPGRADEFONT,
                                                                           new Vector2(itemSize + (int)(((float)(upgradePartsIDs.Count / nbrOfItems) - 0.5) * (float)itemSize), itemSize / 3)),
                                           Color.Gold);

            for (int i = 0; i < itemBoxes.Count; i++)
            {
                itemBoxes[i].Draw(spriteBatch, gameTime);
            }
            if (followMouseSprite != null)
            {
                followMouseSprite.Draw(spriteBatch, gameTime);
            }
        }
コード例 #2
0
 public void Draw(SpriteBatch spriteBatch, GameTime gameTime, SpriteFont font)
 {
     if (Unlocked && !unlockTimer.IsFinished)
     {
         string s = name;
         spriteBatch.DrawString(font, s, DrawHelper.CenteredWordPosition(s, font) + new Vector2(0, -200), Color.PapayaWhip); //! vector + font
     }
 }
コード例 #3
0
        private void DrawCountDown(SpriteBatch spriteBatch, GameTime gameTime)
        {
            string word = "";

            word = COUNTDOWN[(int)eventTimer.currentTime];

            Color color = Color.Gold;

            if ((int)eventTimer.currentTime == 0)
            {
                color = Color.OrangeRed;
            }
            spriteBatch.DrawOutlinedString(3, new Color(32, 32, 32), font, word, DrawHelper.CenteredWordPosition(word, font), color);
        }
コード例 #4
0
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime, bool fullDraw)
        {
            if (!BetweenLevelsTimer.IsFinished && fullDraw)
            {
                Sprite popupBkg = SpriteHandler.GetSprite((int)IDs.POPUPTEXTBKG);
                popupBkg.Position   = wordPos - new Vector2((popupBkg.SpriteRect.Width / 2) - 50, (popupBkg.SpriteRect.Height / 2) - 35);
                popupBkg.Scale      = new Vector2(0.8f, 0.5f);
                popupBkg.LayerDepth = 0;

                popupBkg.Draw(spriteBatch, gameTime); // layer deapth doesnt work sp need this
                string s = "Wave " + Level + " incoming!";

                spriteBatch.DrawOutlinedString(3, new Color(32, 32, 32), DrawHelper.SCOREFONT, s,
                                               DrawHelper.CenteredWordPosition(s, DrawHelper.SCOREFONT, wordPos), Color.Wheat);
            }
        }
コード例 #5
0
        public UpgradeBarItem(Vector2 position, SpriteFont font, IDs id = IDs.DEFAULT) : base(position, id)
        {
            this.font    = font;
            box          = SpriteHandler.GetSprite((int)IDs.EMPTYPART);
            box.Position = position;
            box.Origin  -= new Vector2(-halfSpriteSize, -halfSpriteSize); // corrects origin to sprite
            box.Scale   *= SCALEFACTOR;
            if (id == IDs.RECTHULLPART || id == IDs.HAMMERPART || id == IDs.ROTATEPART)
            {
                Sprite.Scale *= 0.7f;
            }
            BoundBox = new Rectangle((int)position.X, (int)position.Y, (int)(32 * SCALEFACTOR), (int)(32 * SCALEFACTOR));
            BoundBox.Offset(-halfSpriteSize * SCALEFACTOR, -halfSpriteSize * SCALEFACTOR);
            SetPrice();
            SetName();
            Vector2 belowItemVector = new Vector2(position.X, position.Y + halfSpriteSize * SCALEFACTOR + belowItemSpacing);
            Vector2 belowNameVector = new Vector2(belowItemVector.X, belowItemVector.Y + namePriceSpacing);

            belowItemPosition = DrawHelper.CenteredWordPosition(Name, font, belowItemVector);
            belowNamePosition = DrawHelper.CenteredWordPosition("$" + Price.ToString(), font, belowNameVector);
        }
コード例 #6
0
        internal void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            UpgradeBar.Draw(spriteBatch, gameTime);
            Vector2 wordPos  = new Vector2(WindowSize.Width / 2, WindowSize.Height / 2 - 350);
            Sprite  popupBkg = SpriteHandler.GetSprite((int)IDs.POPUPTEXTBKG);

            popupBkg.Scale      = new Vector2(0.8f, 0.5f);
            popupBkg.LayerDepth = 0;

            string temp = "Upgrade your ship!";

            popupBkg.Position = wordPos - new Vector2(popupBkg.SpriteRect.Width / 2 - 55, -40 + popupBkg.SpriteRect.Height / 2);
            popupBkg.Draw(spriteBatch, gameTime);
            spriteBatch.DrawOutlinedString(3, new Color(32, 32, 32), DrawHelper.UPGRADEFONT, temp,
                                           DrawHelper.CenteredWordPosition(temp, DrawHelper.UPGRADEFONT, wordPos), Color.Wheat);
            popupBkg.Draw(spriteBatch, gameTime); // layer deapth doesnt work sp need this

            foreach (KeyValuePair <int, ShipItem> item in shipItems)
            {
                item.Value.Draw(spriteBatch, gameTime);
            }
        }
コード例 #7
0
        internal void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            switch (op.NewGameState)
            {
            case EventOperator.MENU_STATE:
                #region SplashScreen
                if (op.GameState == EventOperator.SPLASH_SCREEN_STATE)
                {
                    if (InputHandler.isJustPressed(MouseButton.LEFT))
                    {
                        eventTimer.Finish();
                    }
                    else
                    {
                        int alphaChannel = (int)(455 * (SPLASHTIME - eventTimer.currentTime) / SPLASHTIME) - 100;
                        logo.MColor = new Color(255, 255, 255, alphaChannel);
                        logo.Draw(spriteBatch, gameTime);
                    }
                }
                #endregion
                #region GiveUp
                else
                {
                    op.ResetGame(false);
                    game.UpdateGame(gameTime, false);
                    game.DrawGame(spriteBatch, gameTime, false);
                    string s = "Mediocre!";     //!
                    spriteBatch.DrawOutlinedString(3, new Color(32, 32, 32), font, s, DrawHelper.CenteredWordPosition(s, font), Color.Gold);
                }
                #endregion
                break;

            case EventOperator.GAME_STATE:
                #region CountDown
                game.DrawGame(spriteBatch, gameTime, false);
                DrawCountDown(spriteBatch, gameTime);
                #endregion
                break;

            case EventOperator.GAME_OVER_STATE:
                #region GameOver Animation
                if (eventTimer.currentTime > STATSTIME)
                {
                    game.UpdateGame(gameTime, false);
                    game.DrawGame(spriteBatch, gameTime, false);
                    Vector2 shitvect = new Vector2(WindowSize.Width / 2 - font.MeasureString("GAME OVER").X / 2, WindowSize.Height / 2 - font.MeasureString("GAME OVER").Y / 2);          //previously bigFont in Game1
                    spriteBatch.DrawOutlinedString(3, new Color(32, 32, 32), font, "GAME OVER", shitvect, Color.OrangeRed);
                }
                #endregion
                #region DrawStats
                else
                {
                    SoundHandler.PlaySong((int)IDs.GAMEOVER);
                    DrawStats(spriteBatch, gameTime);
                    if (InputHandler.isJustPressed(MouseButton.LEFT))
                    {
                        eventTimer = new Timer(0);
                    }
                }
                #endregion
                break;

            case EventOperator.CUT_SCENE_STATE:
                #region Cutscenes
                switch (op.CutSceneType)
                {
                case 1:

                    BossFinishedScene(spriteBatch, gameTime);
                    break;

                case 2:
                    BossAppearanceScene(spriteBatch, gameTime);
                    break;
                }
                #endregion
                break;
            }
        }