Example #1
0
 public void AddParticle(Texture2D tex, float lifeTime, Vector2 Position, Vector2 Speed, Vector2 Acceleration, float Rotation, float RotationSpeed, float SizeMod, ParticleInfo info)
 {
     if (numParticles >= maxParticles)
         return;
     _particles[(startIndex + numParticles) % maxParticles].Create(tex, lifeTime, Position, Speed, Acceleration, Rotation, RotationSpeed, SizeMod, info);
     numParticles++;
 }
Example #2
0
        public void Boom(IMap map,Vector2 pos)
        {
            ParticleInfo info = new ParticleInfo();
            info.collides = true;

            map.SetGlow(-2, pos, Color.LightYellow, 300, true, 500);
            for (int x = 0; x < 60; x++)
                AddParticle(_dustTex, 1.2f, pos + new Vector2((float)_random.NextDouble() * 40 - 20, (float)_random.NextDouble() * 40 - 20), new Vector2((float)_random.NextDouble() * 40 - 20, (float)-(15 + _random.NextDouble() * 10)), new Vector2(0, 20), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), (float)_random.NextDouble() + 0.7f, info);

            for (int x = 0; x < 12; x++)
                AddParticle(_boomTex, 0.7f, pos + new Vector2((float)_random.NextDouble() * 20 - 10, (float)_random.NextDouble() * 20 - 10), new Vector2((float)_random.NextDouble() * 40 - 20, (float)-(15 + _random.NextDouble() * 10)), new Vector2(0, 20), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), (float)_random.NextDouble() * 0.5f + 0.7f, info);
            for (int x = 0; x < 6; x++)
                AddParticle(_expTex, 0.8f, pos, new Vector2((float)_random.NextDouble() * 600 - 300, (float)_random.NextDouble() * 600 - 300), new Vector2(0, 0), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), (float)_random.NextDouble() * 0.2f + 0.4f, info);
        }
Example #3
0
        public override void DoEffect(IGORR.Client.Logic.IMap map, Microsoft.Xna.Framework.Vector2 dir, Microsoft.Xna.Framework.Point position, string info)
        {
            if(smoke==null)
                smoke=ContentInterface.LoadTexture("dust");

            Vector2 pos = new Vector2(position.X, position.Y);
            ParticleInfo pInfo = new ParticleInfo();
            pInfo.collides = true;

            map.SetGlow(-2, pos, Color.Yellow, 40, false, 300);
            Vector2 sideWays = new Vector2(dir.Y, -dir.X);
            if (smoke != null)
                for (int x = 0; x < 80; x++)
                    map.Particles.AddParticle(smoke, 0.7f, pos, 0.6f*dir*(float)_random.NextDouble() + (float)(-0.15f+0.3f*_random.NextDouble()) * sideWays, new Vector2(0, 100), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), (float)_random.NextDouble()*0.7f + 0.4f, pInfo);
        }
Example #4
0
 public void Create(Texture2D tex, float lifeTime, Vector2 Position, Vector2 Speed, Vector2 Acceleration, float Rotation, float RotationSpeed, float SizeMod, ParticleInfo info)
 {
     _texture = tex;
     _lifeTime = lifeTime;
     _position = Position;
     _speed = Speed;
     _size.X = _texture.Width;
     _size.Y = _texture.Height;
     _acceleration = Acceleration;
     _rotation = Rotation;
     _rotSpeed = RotationSpeed;
     _alive = true;
     _stuck = false;
     _sizeMod = SizeMod;
     _info = info;
 }
Example #5
0
        public override void DoEffect(IGORR.Client.Logic.IMap map, Vector2 dir, Point position, string info)
        {
            if (tex1 == null)
            {
                tex1 = ContentInterface.LoadTexture("splat");
                tex2 = ContentInterface.LoadTexture("healthOrb");
            }

            ParticleInfo PInfo = new ParticleInfo();
            PInfo.collides = true;
            PInfo.sticky = false;
            for (int x = 0; x < 1; x++)
            {
                map.Particles.AddParticle(tex1, 0.3f + (float)_random.NextDouble() * 0.2f, new Vector2(position.X, position.Y), Vector2.Zero, new Vector2(0, 0), (float)_random.NextDouble() * 6, (float)_random.NextDouble() * 6, 0.5f, PInfo);
                map.Particles.AddParticle(tex2, 0.6f + (float)_random.NextDouble() * 0.2f, new Vector2(position.X, position.Y), Vector2.Zero, new Vector2(0, 0), (float)_random.NextDouble() * 6, (float)_random.NextDouble() * 6, 0.5f, PInfo);
            }
        }
        public override void DoEffect(IGORR.Client.Logic.IMap map, Vector2 dir, Point position, string info)
        {
            if (shard1 == null)
            {
                shard1 = ContentInterface.LoadTexture("shard1");
                shard2 = ContentInterface.LoadTexture("shard2");
                shard3 = ContentInterface.LoadTexture("shard3");
                shard4 = ContentInterface.LoadTexture("shard4");
            }

            ParticleInfo PInfo = new ParticleInfo();
            PInfo.collides = true;
            PInfo.sticky = false;
            for (int x = 0; x < 2; x++)
            {
                map.Particles.AddParticle(shard1, 2.5f, new Vector2(position.X + (float)_random.NextDouble() * 16 - 8, position.Y + (float)_random.NextDouble() * 16 - 8), new Vector2((float)_random.NextDouble() * 70 - 35, (float)_random.NextDouble() * (-15) - 40), new Vector2(0, 100), (float)_random.NextDouble() * 6, (float)_random.NextDouble() * 6, 0.5f, PInfo);
                map.Particles.AddParticle(shard2, 2.5f, new Vector2(position.X + (float)_random.NextDouble() * 16 - 8, position.Y + (float)_random.NextDouble() * 16 - 8), new Vector2((float)_random.NextDouble() * 70 - 35, (float)_random.NextDouble() * (-15) - 40), new Vector2(0, 100), (float)_random.NextDouble() * 6, (float)_random.NextDouble() * 6, 0.5f, PInfo);
                map.Particles.AddParticle(shard3, 2.5f, new Vector2(position.X + (float)_random.NextDouble() * 16 - 8, position.Y + (float)_random.NextDouble() * 16 - 8), new Vector2((float)_random.NextDouble() * 70 - 35, (float)_random.NextDouble() * (-15) - 40), new Vector2(0, 100), (float)_random.NextDouble() * 6, (float)_random.NextDouble() * 6, 0.5f, PInfo);
                map.Particles.AddParticle(shard4, 2.5f, new Vector2(position.X + (float)_random.NextDouble() * 16 - 8, position.Y + (float)_random.NextDouble() * 16 - 8), new Vector2((float)_random.NextDouble() * 70 - 35, (float)_random.NextDouble() * (-15) - 40), new Vector2(0, 100), (float)_random.NextDouble() * 6, (float)_random.NextDouble() * 6, 0.5f, PInfo);
            }
        }
Example #7
0
        public override void DoEffect(IGORR.Client.Logic.IMap map, Microsoft.Xna.Framework.Vector2 dir, Microsoft.Xna.Framework.Point position, string info)
        {
            if(_smokeTex==null)
                _smokeTex=ContentInterface.LoadTexture("dust");
            if(_fireTex==null)
                _fireTex=ContentInterface.LoadTexture("Boom");
            if(_particleTex==null)
                _particleTex=ContentInterface.LoadTexture("expOrb");

            Vector2 pos = new Vector2(position.X, position.Y);
            ParticleInfo pInfo = new ParticleInfo();
            pInfo.collides = true;

            map.SetGlow(-2, pos, Color.LightYellow, 300, true, 500);
            if(_smokeTex!=null)
            for (int x = 0; x < 60; x++)
                map.Particles.AddParticle(_smokeTex, 1.2f, pos + new Vector2((float)_random.NextDouble() * 40 - 20, (float)_random.NextDouble() * 40 - 20), new Vector2((float)_random.NextDouble() * 40 - 20, (float)-(15 + _random.NextDouble() * 10)), new Vector2(0, 20), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), (float)_random.NextDouble() + 0.7f, pInfo);
            if (_fireTex != null)
            for (int x = 0; x < 12; x++)
                map.Particles.AddParticle(_fireTex, 0.7f, pos + new Vector2((float)_random.NextDouble() * 20 - 10, (float)_random.NextDouble() * 20 - 10), new Vector2((float)_random.NextDouble() * 40 - 20, (float)-(15 + _random.NextDouble() * 10)), new Vector2(0, 20), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), (float)_random.NextDouble() * 0.5f + 0.7f, pInfo);
            if (_particleTex != null)
            for (int x = 0; x < 6; x++)
                map.Particles.AddParticle(_particleTex, 0.8f, pos, new Vector2((float)_random.NextDouble() * 600 - 300, (float)_random.NextDouble() * 600 - 300), new Vector2(0, 0), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), (float)_random.NextDouble() * 0.2f + 0.4f, pInfo);
        }
Example #8
0
 public void Splat(Vector2 position, Vector2 dir)
 {
     ParticleInfo info = new ParticleInfo();
     info.collides = true;
     for (int x = 0; x < 18; x++)
         AddParticle(_splatTex, 4f, position, dir + new Vector2((float)_random.NextDouble() * 40 - 20, (float)-(25 + _random.NextDouble() * 20)), new Vector2(0, 60), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), (float)_random.NextDouble(), info);
     info.sticky = true;
     for (int x = 0; x < 50; x++)
         AddParticle(_bloodTex, 6f, position, dir + new Vector2((float)_random.NextDouble() * 40 - 20, (float)-(25 + _random.NextDouble() * 20)), new Vector2(0, 60), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), (float)_random.NextDouble(), info);
 }
Example #9
0
 public void Run(Vector2 position, Vector2 direction)
 {
     ParticleInfo info = new ParticleInfo();
     for (int x = 0; x < 8; x++)
         AddParticle(_dustTex, 0.25f, position, direction*((float)_random.NextDouble()/2+1)+Vector2.UnitY*((float)_random.NextDouble()*10-5), new Vector2(0, 60), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), (float)_random.NextDouble() * 0.5f + 0.2f,info);
 }
Example #10
0
        public void LandParticles(Vector2 positionLeft, Vector2 positionRight)
        {
            ParticleInfo info = new ParticleInfo();
            for (int x = 0; x < 8; x++)
                AddParticle(_dustTex, 0.25f, positionLeft, new Vector2((float)_random.NextDouble() * 15 - 40, (float)-(15 + _random.NextDouble() * 10)), new Vector2(0, 20), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), (float)_random.NextDouble() * 0.5f + 0.2f, info);

            for (int x = 0; x < 8; x++)
                AddParticle(_dustTex, 0.25f, positionRight, new Vector2((float)-_random.NextDouble() * 15 + 40, (float)-(15 + _random.NextDouble() * 10)), new Vector2(0, 20), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), (float)_random.NextDouble() * 0.5f + 0.2f, info);
        }
Example #11
0
        public void FromTemplate(EffectTemplate temp, Vector2 position, Vector2 dir, bool Right)
        {
            ParticleInfo info = new ParticleInfo();
            info.collides = temp.Collides;
            info.sticky = temp.Sticky;
            for (int x = 0; x < temp.NumParticles; x++)
            {
                float angle = (float)(_random.NextDouble() * Math.PI * 2);
                while (!temp.isInAngles(angle))
                    angle = (float)(_random.NextDouble() * Math.PI * 2);

                AddParticle(temp.Texture,
                    (float)_random.NextDouble() * (temp.LifeTimeRange.X - temp.LifeTimeRange.Y) + temp.LifeTimeRange.X,
                    position + new Vector2(Right ? temp.Offset.X : -temp.Offset.X, temp.Offset.Y),
                    new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * ((float)_random.NextDouble() * (temp.SpeedRange.Y - temp.SpeedRange.X) + temp.SpeedRange.X) + temp.InitialSpeedFactor * dir,
                    Vector2.Zero, 0, 0, (float)_random.NextDouble() * (temp.SizeModRange.Y - temp.SizeModRange.X) + temp.SizeModRange.X, info);

            }
        }
Example #12
0
 public void ExpParticles(int amount, Vector2 startPos, Player player)
 {
     ParticleInfo info = new ParticleInfo();
     info.attractor = player;
     info.maxSpeed = 200f;
     info.attraction = 1000;
     for (int x = 0; x <= amount / 10; x++)
     {
         AddParticle(_expTex, 5f, startPos, new Vector2((float)_random.NextDouble() * 100 - 50, (float)(-50 + _random.NextDouble() * 100)), new Vector2(0, 0), (float)(_random.NextDouble() * Math.PI * 2), (float)(_random.NextDouble() * Math.PI * 2), 1, info);
     }
 }