Ejemplo n.º 1
0
        public void Draw(GameTime gameTime, SpriteBatch spriteBatch, SpriteFont spriteFont)
        {
            spriteBatch.Draw(background, Rectangle, Color.White);
            MoneyAndTowers.Draw(gameTime, spriteBatch, spriteFont);

            if (clickedTower != null)
            {
                SelectedTower.Draw(gameTime, spriteBatch, spriteFont);
            }
            else
            {
                PurchaseTower.Draw(gameTime, spriteBatch, spriteFont);
            }

            StatsAndControls.Draw(gameTime, spriteBatch, spriteFont);
        }
Ejemplo n.º 2
0
        public void Update(GameTime gameTime)
        {
            MoneyAndTowers.GetText("Money").Value  = Session.MoneyDisplay;
            MoneyAndTowers.GetText("Towers").Value = Session.TowersDisplay;
            Button    lnw = StatsAndControls.GetButton("LaunchNextWave");
            Texture2D tex = Session.Map.State == MapState.WaveDelay ? Session.Map.SmallNormalButtonTexture : Session.Map.SmallErrorButtonTexture;
            Color     c   = Session.Map.State == MapState.WaveDelay ? Session.Map.ForeColor : Session.Map.ErrorColor;

            lnw.Texture = tex;
            lnw.SetColor(c);

            if (clickedTower != null)
            {
                foreach (var b in SelectedTower.Buttons)
                {
                    b.Value.Update(gameTime, Session.UI.mouse);
                }
            }
            else
            {
                foreach (var b in PurchaseTower.Buttons)
                {
                    b.Value.Update(gameTime, Session.UI.mouse);
                }
            }

            foreach (var b in StatsAndControls.Buttons)
            {
                b.Value.Update(gameTime, Session.UI.mouse);
            }

            Button isb = StatsAndControls.GetButton("IncreaseSpeed");
            Button dsb = StatsAndControls.GetButton("DecreaseSpeed");

            if (Session.Speed >= Session.MaxSpeed)
            {
                isb.Texture = Session.Map.LargeErrorButtonTexture;
                isb.SetColor(Session.Map.ErrorColor);
                dsb.Texture = Session.Map.LargeNormalButtonTexture;
                dsb.SetColor(Session.Map.ForeColor);
            }
            else if (Session.Speed <= Session.MinSpeed)
            {
                isb.Texture = Session.Map.LargeNormalButtonTexture;
                isb.SetColor(Session.Map.ForeColor);
                dsb.Texture = Session.Map.LargeErrorButtonTexture;
                dsb.SetColor(Session.Map.ErrorColor);
            }
            else
            {
                isb.Texture = Session.Map.LargeNormalButtonTexture;
                isb.SetColor(Session.Map.ForeColor);
                dsb.Texture = Session.Map.LargeNormalButtonTexture;
                dsb.SetColor(Session.Map.ForeColor);
            }

            if (waveindex != Session.Map.WaveIndex)
            {
                waveindex = Session.Map.WaveIndex;
                StatsAndControls.GetText("Wave").Value = String.Format("Wave {0} of {1}", waveindex + 1, Session.Map.WaveList.Count);
            }
        }
Ejemplo n.º 3
0
 private void InitializeMoneyAndTowers()
 {
     MoneyAndTowers.Add("Money", new Text(Session.MoneyDisplay, new Vector2(Rectangle.Left + padding, Rectangle.Top + padding)));
     MoneyAndTowers.Add("Towers", new Text(Session.TowersDisplay, new Vector2(Rectangle.Left + padding, Rectangle.Top + padding + spriteFont.LineSpacing)));
 }