Esempio n. 1
0
        /// <summary>
        /// Draw the Menu (including the buildthings)
        /// </summary>
        /// <param name="spritebatch"></param>
        public void Draw(SpriteBatch spritebatch, Camera2D camera)
        {
            int c = 0;
            mbBegin.SetPosition(position.X, position.Y);
            mbBegin.Draw(spritebatch, camera);
            for (int i = 1; i <= buildthings.Count; i++)
            {

                mbMiddle.SetPosition(position.X + i * 120, position.Y);
                mbMiddle.Draw(spritebatch, camera);
                buildthings[i - 1].SetPosition(position.X + i * 120, position.Y);
                buildthings[i - 1].Draw(spritebatch, camera);
                c = i;
            }
            mbEnd.SetPosition(position.X + c * 120 + 120, position.Y);
            mbEnd.Draw(spritebatch, camera);
            selector.SetPosition(buildthings[selected].xPosition, buildthings[selected].yPosition);
            selector.Draw(spritebatch, camera);
        }
Esempio n. 2
0
        /// <summary>
        /// Draws the Texture with the given SpriteBatch
        /// </summary>
        /// <param name="spritebatch"></param>
        public virtual void Draw(SpriteBatch spritebatch, Camera2D camera = null)
        {
            Vector2 r = new Vector2((int)(xPosition), (int)(yPosition));
            if (camera == null || camera.IsInView(r, texture))
            {
                spritebatch.Draw(texture, r, null, Color.White, (float)(Math.PI * 0.5 * (rotation / 90)), new Vector2(texture.Width / 2, texture.Height / 2), 1, SpriteEffects.None, 0);

            }
        }
Esempio n. 3
0
 /// <summary>
 /// Draws everthing imoveable (unaffected by camera)
 /// </summary>
 /// <param name="spritebatch"></param>
 /// <param name="camera"></param>
 public void DrawOnScreen(SpriteBatch spritebatch, Camera2D camera = null)
 {
     switch (gameState)
     {
         case GameState.Building:
             mb.Draw(spritebatch, camera);
             break;
         case GameState.Defending:
             break;
         case GameState.Loading:
             loading.Draw(spritebatch);
             break;
         case GameState.Menu:
             break;
         default:
             break;
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Draws everything with the given SpriteBatch
 /// </summary>
 /// <param name="spritebatch"></param>
 public void Draw(SpriteBatch spritebatch, Camera2D camera)
 {
     switch (gameState)
     {
         case GameState.Building:
             ground.Draw(spritebatch, camera);
             buildlayer.Draw(spritebatch, camera);
             Cursor.Draw(spritebatch, camera);
             break;
         case GameState.Defending:
             break;
         case GameState.Loading:
             break;
         case GameState.Menu:
             break;
         default:
             break;
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Constructor with internal camera init
 /// </summary>
 /// <param name="textureCache"></param>
 /// <param name="components"></param>
 /// <param name="parent"></param>
 public Level(ConcurrentDictionary<string, Texture2D> textureCache, GameComponentCollection components, Game parent)
     : this(textureCache)
 {
     this.components = components;
     parentGame = parent;
     camera = new Camera2D(parentGame, Cursor);
     components.Add(camera);
 }