public Particle(Vector2 initialPosition, ParticleTemplate template, Entity owner)
        {
            _template = template;
            _owner = owner;

            //Rotation
            Rotation = template.GetValue<float>(ParticleValues.InitialRotation);
            if ((int)Rotation == -1) Rotation = (float)_rand.NextDouble();

            Size = template.GetValue<float>(ParticleValues.InitialSize);
            _secondsRemaining = template.GetValue<float>(ParticleValues.LifeTime);
            Texture = ResourceManager.GetTexture("particles/" + template.GetValue<string>(ParticleValues.Texture));
            Alpha = 1.0f - template.GetValue<float>(ParticleValues.InitialAlpha);
            IsCollidable = template.GetValue<bool>(ParticleValues.CanCollide);
            Position = initialPosition;

            //Sound effect
            string spawnSound = template.GetValue<string>(ParticleValues.SoundEffectOnSpawn);
            if (spawnSound != null) ResourceManager.PlaySoundEffect(spawnSound);

            //camera shake effect
            Camera.shake += template.GetValue<int>(ParticleValues.CameraShake);

            if (template.GetValue<bool>(ParticleValues.AreaOfEffect))
            {
                _areaOfEffect = new HashSet<Entity>();
            }
        }
        public static void SpawnProjectile(Entity shooter, ParticleTemplate template)
        {
            //Don't spawn more particles than the set limit
            if (Count() >= MaxParticles || template == null) return;

            Particle projectile = new Particle(shooter.Position, template, shooter);
            projectile.Rotation = shooter.Rotation;
            projectile.Speed = template.GetValue<float>(ParticleValues.Speed);
            projectile.Team = shooter.Team;

            //Spawn projectile from gun barrel and not unit origin
            projectile.X += (float)Math.Cos(shooter.Rotation) * shooter.Width/2;
            projectile.Y += (float)Math.Sin(shooter.Rotation) * shooter.Width/2;

            //Spawn it and add it last in our list
            SpawnList.AddLast(projectile);
        }