Example #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();
            // Create a new SpriteBatch, which can be used to draw textures.

            IDrawableEffectOverTime d1 = new DrawableFlashingEffectOverTime(5, 50);
            IDrawableEffectOverTime d4 = new DrawableFlashingEffectOverTime(5, 7);

            d1.SetDrawable(_sprite);
            var d2 = new DrawableFlashingEffectOverTime(2, _sprite2, 3);
            var d3 = new DrawableFlashingEffectOverTime(3, _sprite3, 10);

            d4.SetDrawable(_sprite4);

            d2.Frequency = 9;
            d3.Duration  = 20;
            //NOT WORKING_sprite.AddEffect(drawableFlashingEffectOverTime);
            //NOT WORKING_sprite4.AddEffect( d2);

            SpriteDrawer.AddSprite(_sprite);
            SpriteUpdater.AddToUpdate(_sprite);

            SpriteDrawer.AddSprite(_sprite2);
            SpriteUpdater.AddToUpdate(_sprite2);

            SpriteDrawer.AddSprite(_sprite3);
            SpriteUpdater.AddToUpdate(_sprite3);

            SpriteDrawer.AddSprite(_sprite4);
            SpriteUpdater.AddToUpdate(_sprite4);
            // TODO: use this.Content to load your game content here
        }
Example #2
0
        public void AddDrawable(IDrawable drawable)
        {
            ISprite sprite = drawable as ISprite;

            if (sprite != null)
            {
                SpriteDrawer.AddSprite(sprite);
                SpriteUpdater.AddToUpdate(sprite);
            }

            ITextSprite textSprite = drawable as ITextSprite;

            if (textSprite != null)
            {
                TextSpriteDrawer.AddTextSprite(textSprite);
                TextSpriteUpdater.AddToUpdate(textSprite);
            }
        }