using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace TribbleExtinction
{
    public class Effect
    {
        public float duration;

        public float progress;

        public Vector2 position;

        public float spin;
        public float angle;

        public float scale;

        public Texture2D texture;

        public void render(SpriteBatch spriteBatch, GameTime cTime)
        {
            float time = (float)cTime.ElapsedGameTime.TotalSeconds;
            progress -= time;

            angle += spin * time;
            Color c = Color.White;
            if (progress > 0)
            {
                if (progress <= duration)
                    c.A = (byte)(255 * (progress / duration));
                spriteBatch.Draw(texture, position, null, c, angle, new Vector2(texture.Width / 2, texture.Height / 2), scale, SpriteEffects.None, 0);
            }

        }
    }
}
