Esempio n. 1
0
    public void MakeRandomProjectile(GameObject part)
    {
        Vector2    newPos     = Camera.main.ViewportToWorldPoint(new Vector2(UnityEngine.Random.value, UnityEngine.Random.value));
        GameObject projectile = Instantiate(part, newPos, new Quaternion(0, 0, 0, 0));

        projectile.GetComponent <Particle2D>().Create(1, newPos, new Vector2(0, -.01f), 0.999f, 1, unitID);
        particleManager.AddParticle(projectile);
        unitID += 1;
    }
Esempio n. 2
0
        public override void Update(float deltaTime)
        {
            // Rotate.
            rotationAngle += planeRotationSpeed;
            Rotation       = rotationAngle + (float)Math.PI * 0.5f;

            planeOffsetPosition = new Vector2((float)Math.Cos(rotationAngle), (float)Math.Sin(rotationAngle)) * rotationRadius;

            if (SearchAlgorithm != null)
            {
                ShootTimer -= deltaTime;
                FindEnemy();
                if (SearchAlgorithm.FoundEnemy != null)
                {
                    // Shoot.
                    if (ShootTimer <= 0)
                    {
                        Vector2 direction = (CalculateAimPoint(SearchAlgorithm.FoundEnemy, shootBullet) - GetPosition());
                        direction.Normalize();
                        Vector2 bulletPosition = planeOffsetPosition + Position + direction * barrelLength;

                        BulletManager.SpawnBullet(shootBullet.Duplicate(), bulletPosition, direction);

                        Particle flash = new Particle(ShootRate * 0.3f, AssetManager.GetSprite("Fire1"), bulletPosition, Vector2.One, (float)Math.Atan2(direction.Y, direction.X), 1f);
                        particleManager.AddParticle(flash);

                        ShootTimer = ShootRate;
                    }
                }
            }
        }
Esempio n. 3
0
        public override void Update(float deltaTime)
        {
            if (SearchAlgorithm != null)
            {
                ShootTimer -= deltaTime;
                FindEnemy();

                if (SearchAlgorithm.FoundEnemy != null)
                {
                    // Rotate.
                    Vector2 delta = CalculateAimPoint(SearchAlgorithm.FoundEnemy, shootBullet) - Position;
                    Rotation = (float)Math.Atan2(delta.Y, delta.X);

                    // Shoot.
                    if (ShootTimer <= 0)
                    {
                        Vector2 direction      = new Vector2((float)Math.Cos(Rotation), (float)Math.Sin(Rotation));
                        Vector2 bulletPosition = Position + direction * barrelLength;
                        BulletManager.SpawnBullet(shootBullet.Duplicate(), bulletPosition, direction);
                        Particle flash = new Particle(ShootRate * 0.3f, AssetManager.GetSprite("Fire1"), bulletPosition, Vector2.One, Rotation, 1f);
                        particleManager.AddParticle(flash);
                        ShootTimer = ShootRate;
                    }
                }
            }
        }
Esempio n. 4
0
        void RunningState(GameTime gameTime)
        {
            if (_walkingPhysics.movingDirection != Vector2.Zero)
            {
                if (!_instantiatedSmoke)
                {
                    for (int i = 0; i < 8; ++i)
                    {
                        var pos = new Vector2(
                            _player.collisionBox.middle.X - _walkingPhysics.movingDirection.X * 4 + (float)GameManager.random.NextDouble() * 3 - 1.5f,
                            _player.collisionBox.bottom - 1 + (float)GameManager.random.NextDouble() * 3 - 1.5f);
                        var s = new Smoke(pos);
                        s.SetRadius(1, 1.5f);
                        ParticleManager.AddParticle(s);
                    }

                    _instantiatedSmoke = true;
                }

                _player.timeDecrease *= 1.25f;
            }
            else
            {
                _instantiatedSmoke = false;
            }
        }
Esempio n. 5
0
    // Start is called before the first frame update
    void Start()
    {
        PlanetaryForceGenerator.powerOfConstant = powerOfConstant;

        particleManager = GetComponent <ParticleManager>();
        foreach (Particle2D par in GameObject.FindObjectsOfType <Particle2D>())
        {
            particleManager.AddParticle(par);
            ForceManager.AddForceGenerator(new PlanetaryForceGenerator(par));
        }
    }
Esempio n. 6
0
 protected override void Update(GameTime gameTime)
 {
     if (Keyboard.GetState().IsKeyDown(Keys.Escape))
     {
         Exit();
     }
     playerManager.Update(gameTime);
     _worldManager.Update(gameTime);
     _particleManager.AddParticle(new Smoke(playerManager.playerPosition));
     base.Update(gameTime);
 }
Esempio n. 7
0
        public Explosion(Vector2 position) : base(position)
        {
            for (int i = 0; i < particleNumber; i += 1)
            {
                var smoke = new Smoke(transform.position + new Vector2(GameManager.random.Next(6) - 3, GameManager.random.Next(6) - 3));
                smoke.SetColor(Misc.util.Choose <byte>(7, 9));
                ParticleManager.AddParticle(smoke);
            }

            done = true;

            GameManager.pico8.Audio.Sfx(2);
        }
Esempio n. 8
0
        private void AddParticle()
        {
            //出口の粒子
            int tileSize = (int)MapDef.TILE_SIZE;

            for (int i = 0; i < 1; i++)
            {
                Vector3 position = new Vector3(
                    map.EndPoint.X * tileSize,
                    0,
                    map.EndPoint.Y * tileSize);
                position += new Vector3(
                    gameDevice.Random.Next(-tileSize * 45, tileSize * 45 + 1) / 100.0f,
                    0,
                    gameDevice.Random.Next(-tileSize * 45, tileSize * 45 + 1) / 100.0f);
                position.Y = tileSize / 2;
                pManager.AddParticle(new TransportParticle(position, stageManager.ConstactColor(), gameDevice));
            }

            //以下は浮遊粒子
            if (!stageManager.UseParticle())
            {
                return;
            }

            if (pManager.Count() < 1500)
            {
                for (int i = 0; i < 20; i++)
                {
                    Vector3 position = characterManager.GetPlayer().GetPosition;
                    position += new Vector3(
                        gameDevice.Random.Next(-30000, 30001) / 100.0f,
                        0,
                        gameDevice.Random.Next(-30000, 30001) / 100.0f);
                    position.Y = tileSize / 2;
                    pManager.AddParticle(new SphereParticle(position, stageManager.ConstactColor(), gameDevice));
                }
            }
        }
Esempio n. 9
0
        private void AddSphereParticle()
        {
            if (!stageManager.UseParticle())
            {
                return;
            }

            float tileSize = MapDef.TILE_SIZE;

            if (pManager.Count() < 1500)
            {
                for (int i = 0; i < 30; i++)
                {
                    Vector3 position = characterManager.GetPlayer().GetPosition;
                    position += new Vector3(
                        gameDevice.Random.Next(-30000, 30001) / 100.0f,
                        gameDevice.Random.Next(-30000, 30001) / 100.0f,
                        gameDevice.Random.Next(-30000, 30001) / 100.0f);
                    position.Y = 0;
                    pManager.AddParticle(new SphereParticle(position, stageManager.ConstactColor(), gameDevice));
                }
            }
        }
Esempio n. 10
0
        public Chimney(Vector2 position) : base(position)
        {
            //
            // Create object that will instantiate smoke particles every 30 milliseconds.
            //

            var random = new Random();

            smokeParticleTask = Misc.TaskScheduler.AddTask(() =>
            {
                var smoke = new Smoke(transform.position + new Vector2(3 + (float)random.NextDouble() + 0.5f, -1));
                smoke.SetRadius(0.95f, 1.95f);
                //smoke.SetRadiusDecreaseSpeed(0.1f);
                ParticleManager.AddParticle(smoke);
            }, 0.130, -1, this.id);
        }
Esempio n. 11
0
        public Altar(Vector2 position) : base(position)
        {
            _key = new Key(position + new Vector2(4, -2));
            GameObjectManager.AddObject(_key);

            TaskScheduler.AddTask(() => {
                var smoke = new Smoke(position + new Vector2(4 + (float)GameManager.random.NextDouble() * 8, 8));
                smoke.SetColor(9);
                smoke.SetRadius(1, 1.5f);
                ParticleManager.AddParticle(smoke);
            }, 0.1f, -1, this.id);

            AddComponent(new P8Sprite(78, 2, 2));

            depth = -1000;
        }
Esempio n. 12
0
        /// <summary>
        /// Actualiza las partículas activas en el gestor de partículas
        /// </summary>
        /// <param name="particleManager">Gestor de partículas</param>
        protected void UpdateParticles(ParticleManager particleManager)
        {
            foreach (ParticleEmitter emitter in this.m_ParticleEmitterList)
            {
                if (emitter.Active)
                {
                    Matrix mtr = emitter.GetModelMatrix(this.m_AnimationController, this.CurrentTransform);

                    particleManager.AddParticle(emitter.ParticleType, mtr.Translation, mtr.Backward);

                    if (emitter.UniqueParticle)
                    {
                        emitter.Active = false;
                    }
                }
            }
        }
Esempio n. 13
0
        public FirePit(Vector2 position) : base(position)
        {
            particleNumber = 1;

            var random = new Random();

            //
            // Create object that will instantiate smoke particles every 30 milliseconds.
            //

            fireParticleTask = Misc.TaskScheduler.AddTask(() =>
            {
                for (int i = 0; i < particleNumber; i += 1)
                {
                    var smoke = new Smoke(transform.position + new Vector2(4 + random.Next(2) - 1, 3 + random.Next(2) - 1));
                    smoke.SetColor(Misc.util.Choose <byte>(7, 9));
                    ParticleManager.AddParticle(smoke);
                }
            }, 0.04, -1, this.id);
        }
Esempio n. 14
0
        void FullInit(SpikeStates previous)
        {
            _spike.sprite.index = 122;

            for (int i = 0; i < particleNumber; i += 1)
            {
                var smoke =
                    new Smoke(_spike.transform.position + new Vector2(1 + GameManager.random.Next(6), GameManager.random.Next(6)));
                smoke.SetRadius(1, 1.5f);
                smoke.SetMaxMoveSpeed(10f + (float)GameManager.random.NextDouble() * 5f);
                smoke.SetRadiusDecreaseSpeed(3f + (float)GameManager.random.NextDouble());
                ParticleManager.AddParticle(smoke);
            }

            _spike.collisionBox = new Box(_spike.transform.position, new Vector2(6, 6), false, new Vector2(1, 1));

            ((Camera)GameObjectManager.FindObjectWithTag("camera"))?.AddShake(0.1);

            task = TaskScheduler.AddTask(() => Init(SpikeStates.Down), changeStateTime, changeStateTime, _spike.id);
        }
Esempio n. 15
0
        void FollowingState(GameTime gameTime)
        {
            var player = GameObjectManager.FindObjectWithTag("player");

            if (player == null)
            {
                return;
            }

            _goose.transform.direction = player.transform.position - _goose.transform.position;

            if ((player.transform.position - _goose.transform.position).LengthSquared() < 500)
            {
                Init(GooseStates.Still);
            }

            if (GameManager.random.NextDouble() < 0.05)
            {
                ParticleManager.AddParticle(new TextParticle(_goose.transform.position + new Vector2(-8, -8), "HONK", 7));
            }
        }
Esempio n. 16
0
        void ChasingState(GameTime gameTime)
        {
            var player = GameObjectManager.FindObjectWithTag("player");

            if (player == null)
            {
                return;
            }

            _goose.transform.direction = player.transform.position - _goose.transform.position;

            //if (Vector2.Dot(player.GetComponent<APhysics>().facingDirection, player.transform.position - _goose.transform.position) < 0)
            //{
            //    Init(GooseStates.Wondering);
            //}

            if (GameManager.random.NextDouble() < 0.05)
            {
                ParticleManager.AddParticle(new TextParticle(_goose.transform.position + new Vector2(-8, -8), "HONK", 7));
            }
        }
Esempio n. 17
0
 protected virtual void Start()
 {
     Manager.AddParticle(this);
 }
Esempio n. 18
0
        public void Update(Character[] c, ParticleManager pMan)
        {
            LocalNetworkGamer gamer = GetGamer();

            if (gamer == null)
            {
                return;
            }

            frame -= FrameTime;
            if (frame < 0f)
            {
                frame = .05f;



                if (netPlay.Hosting)
                {
                    if (c[0] != null)
                    {
                        writer.Write(MSG_SERVER_DATA);

                        c[0].WriteToNet(writer);

                        for (int i = 2; i < c.Length; i++)
                        {
                            if (c[i] != null)
                            {
                                c[i].WriteToNet(writer);
                            }
                        }

                        pMan.NetWriteParticles(writer);

                        writer.Write(MSG_END);
                        gamer.SendData(writer, SendDataOptions.None);
                    }
                }
                if (netPlay.Joined)
                {
                    if (c[1] != null)
                    {
                        writer.Write(MSG_CLIENT_DATA);

                        c[1].WriteToNet(writer);

                        pMan.NetWriteParticles(writer);

                        writer.Write(MSG_END);
                        gamer.SendData(writer, SendDataOptions.None);
                    }
                }
            }
            if (gamer.IsDataAvailable)
            {
                NetworkGamer sender;
                gamer.ReceiveData(reader, out sender);

                if (!sender.IsLocal)
                {
                    byte type = reader.ReadByte();

                    if (netPlay.Joined)
                    {
                        for (int i = 0; i < c.Length; i++)
                        {
                            if (i != 1)
                            {
                                if (c[i] != null)
                                {
                                    c[i].ReceivedNetUpdate = false;
                                }
                            }
                        }
                    }

                    bool end = false;
                    while (!end)
                    {
                        byte msg = reader.ReadByte();
                        switch (msg)
                        {
                        case MSG_END:
                            end = true;
                            break;

                        case MSG_CHARACTER:

                            int defID = NetPacker.SbyteToInt(reader.ReadSByte());
                            int team  = NetPacker.SbyteToInt(reader.ReadSByte());
                            int ID    = NetPacker.SbyteToInt(reader.ReadSByte());

                            if (c[ID] == null)
                            {
                                c[ID] = new Character(new Vector2(),
                                                      Game1.charDef[defID],
                                                      ID, team);
                            }

                            c[ID].ReadFromNet(reader);

                            c[ID].ReceivedNetUpdate = true;
                            break;

                        case MSG_PARTICLE:
                            byte pType = reader.ReadByte();
                            bool bg    = reader.ReadBoolean();

                            switch (pType)
                            {
                            case Particle.PARTICLE_NONE:
                                //
                                break;

                            case Particle.PARTICLE_BLOOD:
                                pMan.AddParticle(new Blood(reader), bg, true);
                                break;

                            case Particle.PARTICLE_BLOOD_DUST:
                                pMan.AddParticle(new BloodDust(reader), bg, true);
                                break;

                            case Particle.PARTICLE_BULLET:
                                pMan.AddParticle(new Bullet(reader), bg, true);
                                break;

                            case Particle.PARTICLE_FIRE:
                                pMan.AddParticle(new Fire(reader), bg, true);
                                break;

                            case Particle.PARTICLE_FOG:
                                pMan.AddParticle(new Fog(reader), bg, true);
                                break;

                            case Particle.PARTICLE_HEAT:
                                pMan.AddParticle(new Heat(reader), bg, true);
                                break;

                            case Particle.PARTICLE_HIT:
                                pMan.AddParticle(new Hit(reader), bg, true);
                                break;

                            case Particle.PARTICLE_MUZZLEFLASH:
                                pMan.AddParticle(new MuzzleFlash(reader), bg, true);
                                break;

                            case Particle.PARTICLE_ROCKET:
                                pMan.AddParticle(new Rocket(reader), bg, true);
                                break;

                            case Particle.PARTICLE_SHOCKWAVE:
                                pMan.AddParticle(new Shockwave(reader), bg, true);
                                break;

                            case Particle.PARTICLE_SMOKE:
                                pMan.AddParticle(new Smoke(reader), bg, true);
                                break;

                            default:
                                //Error!
                                break;
                            }
                            break;
                        }
                    }

                    if (netPlay.Joined)
                    {
                        for (int i = 0; i < c.Length; i++)
                        {
                            if (i != 1)
                            {
                                if (c[i] != null)
                                {
                                    if (c[i].ReceivedNetUpdate == false)
                                    {
                                        c[i] = null;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 19
0
        public void Update(ParticleManager pMan, Character[] c)
        {
            CheckTransitions(c);
            if (transOutFrame > 0f)
            {
                transOutFrame -= Game1.FrameTime * 3f;
                if (transOutFrame <= 0f)
                {
                    path = TransitionDestination[(int)TransDir];
                    Read();
                    transInFrame = 1.1f;
                    for (int i = 1; i < c.Length; i++)
                    {
                        c[i] = null;
                    }
                    pMan.Reset();
                }
            }
            if (transInFrame > 0f)
            {
                transInFrame -= Game1.FrameTime * 3f;
            }

            if (mapScript.IsReading)
            {
                mapScript.DoScript(c);
            }

            if (Bucket != null)
            {
                if (!Bucket.IsEmpty)
                {
                    Bucket.Update(c);
                }
            }

            frame += Game1.FrameTime;


            if (Fog > -1)
            {
                if ((int)(pFrame * 10f) != (int)(frame * 10f))
                {
                    pMan.AddParticle(new Fog(
                                         Rand.GetRandomVector2(0f, (float)xSize * 64f,
                                                               (float)Fog + 150f, (float)Fog + 300f)));
                }
            }
            for (int i = 0; i < 64; i++)
            {
                if (mapSeg[LAYER_MAP, i] != null)
                {
                    if (segDef[mapSeg[LAYER_MAP, i].GetDefIdx()].GetFlags() ==
                        SegmentDefinition.FLAGS_TORCH)
                    {
                        pMan.AddParticle(new Smoke(
                                             mapSeg[LAYER_MAP, i].GetLoc() * 2f
                                             + new Vector2(20f, 13f),
                                             Rand.GetRandomVector2(-50.0f, 50.0f, -300.0f, -200.0f),
                                             1.0f, 0.8f, 0.6f, 1.0f, Rand.GetRandomFloat(0.25f, 0.5f),
                                             Rand.GetRandomInt(0, 4)), true);
                        pMan.AddParticle(new Fire(
                                             mapSeg[LAYER_MAP, i].GetLoc() * 2f
                                             + new Vector2(20f, 37f),
                                             Rand.GetRandomVector2(
                                                 -30.0f, 30.0f, -250.0f, -200.0f),
                                             Rand.GetRandomFloat(0.25f, 0.75f),
                                             Rand.GetRandomInt(0, 4)), true);
                        pMan.AddParticle(new Heat(mapSeg[LAYER_MAP, i].GetLoc() * 2f
                                                  + new Vector2(20f, -50f),
                                                  Rand.GetRandomVector2(-50f, 50f, -400f, -300f),
                                                  Rand.GetRandomFloat(1f, 2f)));
                    }
                }
            }

            pFrame = frame;
        }
Esempio n. 20
0
        public void Update(ParticleManager pMan, Character[] c)
        {
            CheckTransitions(c);
            if (TransOutFrame > 0f)
            {
                TransOutFrame -= Game1.FrameTime * 3f;
                if (TransOutFrame <= 0f)
                {
                    Path = TransitionDestination[(int)TransDir];
                    Read();
                    TransInFrame = 1.1f;

                    for (var i = 1; i < c.Length; i++)
                    {
                        c[i] = null;
                    }

                    pMan.Reset();
                }
            }
            if (TransInFrame > 0f)
            {
                TransInFrame -= Game1.FrameTime * 3f;
            }

            if (MapScript.IsReading)
            {
                MapScript.DoScript(c);
            }

            if (Bucket != null)
            {
                if (!Bucket.IsEmpty)
                {
                    Bucket.Update(c);
                }
            }

            Frame += Game1.FrameTime;

            if (Fog)
            {
                if ((int)(PFrame * 10f) != (int)(Frame * 10f))
                {
                    pMan.AddParticle(new Fog(Rand.GetRandomVector2(0f, 1280f, 600f, 1000f)));
                }
            }

            for (var i = 0; i < 64; i++)
            {
                if (Segments[LayerMap, i] != null)
                {
                    if (SegmentDefinitions[Segments[LayerMap, i].Index].Flags == (int)SegmentFlags.Torch)
                    {
                        pMan.AddParticle(
                            new Smoke(
                                Segments[LayerMap, i].Location * 2f + new Vector2(20f, 13f),
                                Rand.GetRandomVector2(-50.0f, 50.0f, -300.0f, -200.0f),
                                1.0f, 0.8f, 0.6f, 1.0f,
                                Rand.GetRandomFloat(0.25f, 0.5f), Rand.GetRandomInt(0, 4)
                                ),
                            true
                            );
                        pMan.AddParticle(
                            new Fire(
                                Segments[LayerMap, i].Location * 2f + new Vector2(20f, 37f),
                                Rand.GetRandomVector2(-30.0f, 30.0f, -250.0f, -200.0f),
                                Rand.GetRandomFloat(0.25f, 0.75f),
                                Rand.GetRandomInt(0, 4)
                                ),
                            true
                            );
                    }
                }
            }
        }
Esempio n. 21
0
        private void FireTrig(int trig, Vector2 loc, ParticleManager pMan)
        {
            switch (trig)
            {
            case TrigPistolAcross:
                pMan.MakeBullet(loc, new Vector2(2000, 0), Face, Id);
                Sound.PlayCue("revol");
                break;

            case TrigPistolDown:
                pMan.MakeBullet(loc, new Vector2(1400, 1400), Face, Id);
                Sound.PlayCue("revol");
                break;

            case TrigPistolUp:
                pMan.MakeBullet(loc, new Vector2(1400, -1400), Face, Id);
                Sound.PlayCue("revol");
                break;

            case TrigBloodSquirtBack:
            case TrigBloodSquirtDown:
            case TrigBloodSquirtDownBack:
            case TrigBloodSquirtDownForward:
            case TrigBloodSquirtForward:
            case TrigBloodSquirtUp:
            case TrigBloodSquirtUpBack:
            case TrigBloodSquirtUpForward:
                var r = 0.0;
                switch (trig)
                {
                case TrigBloodSquirtForward:
                    r = 0.0;
                    break;

                case TrigBloodSquirtDownForward:
                    r = Math.PI * .25;
                    break;

                case TrigBloodSquirtDown:
                    r = Math.PI * .5;
                    break;

                case TrigBloodSquirtDownBack:
                    r = Math.PI * .75;
                    break;

                case TrigBloodSquirtBack:
                    r = Math.PI;
                    break;

                case TrigBloodSquirtUpBack:
                    r = Math.PI * 1.25;
                    break;

                case TrigBloodSquirtUp:
                    r = Math.PI * 1.5;
                    break;

                case TrigBloodSquirtUpForward:
                    r = Math.PI * 1.75;
                    break;
                }

                for (var i = 0; i < 7; i++)
                {
                    pMan.AddParticle(new Blood(loc,
                                               new Vector2((float)Math.Cos(r) * (Face == CharDir.Right ? 1f : -1f), (float)Math.Sin(r)) *
                                               Rand.GetRandomFloat(10f, 500f) + Rand.GetRandomVector2(-90f, 90f, -90f, 90f), 1f, 0f, 0f, 1f,
                                               Rand.GetRandomFloat(0.1f, 0.5f), Rand.GetRandomInt(0, 4)));
                }
                pMan.AddParticle(new BloodDust(loc, Rand.GetRandomVector2(-30f, 30f, -30f, 30f), 1f, 0f, 0f, .2f,
                                               Rand.GetRandomFloat(.25f, .5f), Rand.GetRandomInt(0, 4)));
                break;

            case TrigBloodCloud:
                pMan.AddParticle(new BloodDust(loc, Rand.GetRandomVector2(-30f, 30f, -30f, 30f), 1f, 0f, 0f, .4f,
                                               Rand.GetRandomFloat(.25f, .75f), Rand.GetRandomInt(0, 4)));
                break;

            case TrigBloodSplat:
                for (var i = 0; i < 6; i++)
                {
                    pMan.AddParticle(new BloodDust(loc, Rand.GetRandomVector2(-30f, 30f, -30f, 30f), 1f, 0f, 0f, .4f,
                                                   Rand.GetRandomFloat(.025f, .125f), Rand.GetRandomInt(0, 4)));
                }
                break;

            default:
                pMan.AddParticle(new Hit(loc, new Vector2(200f * (float)Face - 100f, 0f), Id, trig));
                break;
            }

            switch (trig)
            {
            case TrigPistolAcross:
            case TrigPistolUp:
            case TrigPistolDown:
                if (Team == TeamGoodGuys && Id < 4)
                {
                    QuakeManager.SetRumble(Id, 1, .5f);
                    QuakeManager.SetRumble(Id, 0, .3f);
                }
                break;
            }
        }
Esempio n. 22
0
        private void FireTrig(int trig, Vector2 loc, ParticleManager pMan)
        {
            switch (trig)
            {
            case TRIG_PISTOL_ACROSS:
            case TRIG_PISTOL_UP:
            case TRIG_PISTOL_DOWN:
                if (Team == TEAM_GOOD_GUYS && ID < 4)
                {
                    QuakeManager.SetRumble(ID, 1, .5f);
                    QuakeManager.SetRumble(ID, 0, .3f);
                }
                break;
            }
            switch (trig)
            {
            case TRIG_FIRE_DIE:
                for (int i = 0; i < 5; i++)
                {
                    pMan.AddParticle(new Fire(loc +
                                              Rand.GetRandomVector2(-30f, 30f, -30f, 30f),
                                              Rand.GetRandomVector2(-5f, 60f, -150f, -20f),
                                              Rand.GetRandomFloat(.3f, .8f), Rand.GetRandomInt(0, 4),
                                              Rand.GetRandomFloat(.5f, .8f)));
                }
                pMan.AddParticle(new Smoke(loc,
                                           Rand.GetRandomVector2(-10f, 10f, -60f, 10f),
                                           1f, .8f, .6f, 1f, Rand.GetRandomFloat(.5f, 1.2f),
                                           Rand.GetRandomInt(0, 4)));
                pMan.AddParticle(new Heat(loc,
                                          Rand.GetRandomVector2(-50f, 50f, -100f, 0f),
                                          Rand.GetRandomFloat(1f, 2f)));
                break;

            case TRIG_ROCKET:
                pMan.AddParticle(new Rocket(loc, new Vector2((Face == CharDir.Right ? 350f : -350f),
                                                             100f), ID));
                break;

            case TRIG_PISTOL_ACROSS:
                pMan.MakeBullet(loc, new Vector2(2000f, 0f), Face, ID);
                Sound.PlayCue("revol");
                //QuakeManager.SetQuake(0.3f);
                break;

            case TRIG_PISTOL_DOWN:
                pMan.MakeBullet(loc, new Vector2(1400f, 1400f), Face, ID);
                Sound.PlayCue("revol");
                //QuakeManager.SetQuake(0.3f);
                break;

            case TRIG_PISTOL_UP:
                pMan.MakeBullet(loc, new Vector2(1400f, -1400f), Face, ID);
                Sound.PlayCue("revol");
                //QuakeManager.SetQuake(0.3f);
                break;

            case TRIG_BLOOD_SQUIRT_BACK:
            case TRIG_BLOOD_SQUIRT_DOWN:
            case TRIG_BLOOD_SQUIRT_DOWN_BACK:
            case TRIG_BLOOD_SQUIRT_DOWN_FORNWARD:
            case TRIG_BLOOD_SQUIRT_FORWARD:
            case TRIG_BLOOD_SQUIRT_UP:
            case TRIG_BLOOD_SQUIRT_UP_BACK:
            case TRIG_BLOOD_SQUIRT_UP_FORWARD:
                double r = 0.0;
                switch (trig)
                {
                case TRIG_BLOOD_SQUIRT_FORWARD:
                    r = 0.0;
                    break;

                case TRIG_BLOOD_SQUIRT_DOWN_FORNWARD:
                    r = Math.PI * .25;
                    break;

                case TRIG_BLOOD_SQUIRT_DOWN:
                    r = Math.PI * .5;
                    break;

                case TRIG_BLOOD_SQUIRT_DOWN_BACK:
                    r = Math.PI * .75;
                    break;

                case TRIG_BLOOD_SQUIRT_BACK:
                    r = Math.PI;
                    break;

                case TRIG_BLOOD_SQUIRT_UP_BACK:
                    r = Math.PI * 1.25;
                    break;

                case TRIG_BLOOD_SQUIRT_UP:
                    r = Math.PI * 1.5;
                    break;

                case TRIG_BLOOD_SQUIRT_UP_FORWARD:
                    r = Math.PI * 1.75;
                    break;
                }
                for (int i = 0; i < 7; i++)
                {
                    pMan.AddParticle(new Blood(loc, new Vector2(
                                                   (float)Math.Cos(r) * (Face == CharDir.Right ? 1f : -1f),
                                                   (float)Math.Sin(r)
                                                   ) * Rand.GetRandomFloat(10f, 500f) +
                                               Rand.GetRandomVector2(-90f, 90f, -90f, 90f),
                                               1f, 0f, 0f, 1f, Rand.GetRandomFloat(0.1f, 0.5f),
                                               Rand.GetRandomInt(0, 4)));
                }
                pMan.AddParticle(new BloodDust(loc,
                                               Rand.GetRandomVector2(-30f, 30f, -30f, 30f),
                                               1f, 0f, 0f, .2f,
                                               Rand.GetRandomFloat(.25f, .5f),
                                               Rand.GetRandomInt(0, 4)));
                break;

            case TRIG_BLOOD_CLOUD:
                pMan.AddParticle(new BloodDust(loc,
                                               Rand.GetRandomVector2(-30f, 30f, -30f, 30f),
                                               1f, 0f, 0f, .4f,
                                               Rand.GetRandomFloat(.25f, .75f),
                                               Rand.GetRandomInt(0, 4)));
                break;

            case TRIG_BLOOD_SPLAT:
                for (int i = 0; i < 6; i++)
                {
                    pMan.AddParticle(new BloodDust(loc,
                                                   Rand.GetRandomVector2(-30f, 30f, -30f, 30f),
                                                   1f, 0f, 0f, .4f,
                                                   Rand.GetRandomFloat(.025f, .125f),
                                                   Rand.GetRandomInt(0, 4)));
                }
                break;

            default:
                pMan.AddParticle(new Hit(loc, new Vector2(
                                             200f * (float)Face - 100f, 0f),
                                         ID, trig));
                break;
            }
        }