Ejemplo n.º 1
0
 public void Reset(IDrawable sprite)
 {
     sprite.Opacity          = 1;
     sprite.Rotation         = 0;
     sprite.Scale            = new Vector2(1, 1);
     sprite.CurrentFrame     = 1;
     sprite.CurrentAnimation = null;
 }
Ejemplo n.º 2
0
        /*-------------*/
        /* CONSTRUCTOR */
        /*-------------*/
        public TextSpriteFlashingEffectOverTime(int frequency, ITextSprite textTextSprite, float duration = 5)
        {
            Duration        = duration;
            ElapsedLifeTime = 0;
            _frequency      = frequency;

            AffectedDrawable = textTextSprite;
            textTextSprite.Effects.Add(this);
            BaseObject = new TextSprite(textTextSprite.ScreenPosition, textTextSprite.Text);
        }
Ejemplo n.º 3
0
        public void Reset()
        {
            IDrawable drawable = (IDrawable)BaseObject;

            if (drawable == null)
            {
                throw new InvalidCastException("ERROR : CAST FROM OBJECT TO IDRAWABLE FAILED");
            }
            AffectedDrawable.Opacity          = drawable.Opacity;
            AffectedDrawable.Rotation         = drawable.Rotation;
            AffectedDrawable.Scale            = drawable.Scale;
            AffectedDrawable.CurrentFrame     = drawable.CurrentFrame;
            AffectedDrawable.CurrentAnimation = drawable.CurrentAnimation;
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
 /*------------*/
 /*   METHODS  */
 /*------------*/
 public void SetDrawable(IDrawable drawable)
 {
     AffectedDrawable = drawable;
     drawable.Effects.Add(this);
 }