Example #1
0
        public override void Update(float gameTime, Map map, ParticleManager pMan, Character[] c)
        {
            if (HitManager.CheckHit(this, c, pMan))
                frame = 0f;

            trajectory.Y = (float)Math.Sin((double)frame * 13.0) * 150f;

            if (map.CheckParticleCollision(location))
            {
                this.frame = 0f;
                pMan.MakeExplosion(location, 1f);
            }

            pMan.AddParticle(new Fire(location, -trajectory / 8f,
                .5f, RandomGenerator.GetRandomInt(0, 4)));
            pMan.AddParticle(new Smoke(location,
                RandomGenerator.GetRandomVector2(-20f, 20f, -50f, 10f)
                - trajectory / 10f,
                1f, .8f, .6f, 1f, .5f,
                RandomGenerator.GetRandomInt(0, 4)));
            pMan.AddParticle(new Heat(location,
                RandomGenerator.GetRandomVector2(-20f, 20f, -50f, -10f),
                RandomGenerator.GetRandomFloat(.5f, 2f)));

            base.Update(gameTime, map, pMan, c);
        }
Example #2
0
        /// <summary>
        /// Gets a Trigger and it's location and then usually creates new Particles,
        /// plays sound and set screen shake.
        /// This method has been verified!
        /// </summary>
        /// <param name="trigger">The trigger.</param>
        /// <param name="location">The location.</param>
        /// <param name="particleManager">The particle manager.</param>
        private void FireTrigger(int trigger, Vector2 location, ParticleManager particleManager)
        {
            switch (trigger)
            {
                case TRIG_PISTOL_ACROSS:
                case TRIG_PISTOL_UP:
                case TRIG_PISTOL_DOWN:
                    if (Team == TEAM_PLAYERS && ID < 4)
                    {
                        QuakeManager.SetRumble(ID, 1, .5f);
                        QuakeManager.SetRumble(ID, 0, .3f);
                    }
                    break;
            }

            #region Trigger Code

            switch (trigger)
            {
                case TRIG_FIRE_DIE:
                    for (int i = 0; i < 5; i++)
                    {
                        particleManager.AddParticle(new Fire(location +
                            RandomGenerator.GetRandomVector2(-30f, 30f, -30f, 30f),
                            RandomGenerator.GetRandomVector2(-5f, 60f, -150f, -20f),
                            RandomGenerator.GetRandomFloat(.3f, .8f), RandomGenerator.GetRandomInt(0, 4),
                            RandomGenerator.GetRandomFloat(.5f, .8f)));
                    }
                    particleManager.AddParticle(new Smoke(location,
                        RandomGenerator.GetRandomVector2(-10f, 10f, -60f, 10f),
                        1f, .8f, .6f, 1f, RandomGenerator.GetRandomFloat(.5f, 1.2f),
                        RandomGenerator.GetRandomInt(0, 4)));
                    particleManager.AddParticle(new Heat(location,
                        RandomGenerator.GetRandomVector2(-50f, 50f, -100f, 0f),
                        RandomGenerator.GetRandomFloat(1f, 2f)));
                    break;
                case TRIG_ROCKET:
                    particleManager.AddParticle(new Rocket(location, new Vector2((Face == CharacterDirection.Right ? 350f : -350f),
                        100f), ID));
                    break;
                case TRIG_PISTOL_ACROSS:
                    particleManager.MakeBullet(location, new Vector2(2000f, 0f), Face, ID);
                    Sound.PlayCue("revol");
                    QuakeManager.SetQuake(0.3f);
                    break;
                case TRIG_PISTOL_DOWN:
                    particleManager.MakeBullet(location, new Vector2(1400f, 1400f), Face, ID);
                    Sound.PlayCue("revol");
                    QuakeManager.SetQuake(0.3f);
                    break;
                case TRIG_PISTOL_UP:
                    particleManager.MakeBullet(location, 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_FORWARD:
                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 (trigger)
                    {
                        case TRIG_BLOOD_SQUIRT_FORWARD:
                            r = 0.0;
                            break;
                        case TRIG_BLOOD_SQUIRT_DOWN_FORWARD:
                            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++)
                    {
                        particleManager.AddParticle(new Blood(location, new Vector2(
                            (float)Math.Cos(r) * (Face == CharacterDirection.Right ? 1f : -1f),
                            (float)Math.Sin(r)
                            ) * RandomGenerator.GetRandomFloat(10f, 500f) +
                            RandomGenerator.GetRandomVector2(-90f, 90f, -90f, 90f),
                            0.3f, 0f, 0f, 1f, RandomGenerator.GetRandomFloat(0.1f, 0.5f),
                            RandomGenerator.GetRandomInt(0, 4)));
                    }
                    particleManager.AddParticle(new BloodDust(location,
                        RandomGenerator.GetRandomVector2(-30f, 30f, -30f, 30f),
                        0.3f, 0f, 0f, .2f,
                        RandomGenerator.GetRandomFloat(.25f, .5f),
                        RandomGenerator.GetRandomInt(0, 4)));
                    break;
                case TRIG_BLOOD_CLOUD:
                    particleManager.AddParticle(new BloodDust(location,
                        RandomGenerator.GetRandomVector2(-30f, 30f, -30f, 30f),
                        0.3f, 0f, 0f, .4f,
                        RandomGenerator.GetRandomFloat(.25f, .75f),
                        RandomGenerator.GetRandomInt(0, 4)));
                    break;
                case TRIG_BLOOD_SPLAT:
                    for (int i = 0; i < 6; i++)
                    {
                        particleManager.AddParticle(new BloodDust(location,
                        RandomGenerator.GetRandomVector2(-30f, 30f, -30f, 30f),
                        0.3f, 0f, 0f, .4f,
                        RandomGenerator.GetRandomFloat(.025f, .125f),
                        RandomGenerator.GetRandomInt(0, 4)));
                    }
                    break;
                default:
                    particleManager.AddParticle(new Hit(location, new Vector2(
                        200f * (float)Face - 100f, 0f),
                        ID, trigger));
                    break;
            }
            #endregion
        }
Example #3
0
        public void Update(ParticleManager particleManager, Character[] characters)
        {
            CheckTransitions(characters);
            if (transOutFrame > 0f)
            {
                transOutFrame -= RuinExplorersMain.FrameTime * 3f;
                if (transOutFrame <= 0)
                {
                    path = transitionDestination[(int)TransDir];
                    Read();
                    transInFrame = 1.1f;
                    for (int i = 1; i < characters.Length; i++)
                    {
                        characters[i] = null;
                    }
                    particleManager.Reset();
                }
            }

            if (transInFrame > 0f)
            {
                transInFrame -= RuinExplorersMain.FrameTime * 3f;
            }

            if (mapScript.IsReading)
                mapScript.DoScript(characters);

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

            frame += RuinExplorersMain.FrameTime;

            if (Fog > -1)
            {
                if ((int)(previousFrame * 10f) != (int)(frame * 10f))
                    particleManager.AddParticle(new Fog(RandomGenerator.GetRandomVector2(0f, 1280f, 600f, 1000f)));
            }

            for (int i = 0; i < 64; i++)
            {
                if (mapSegment[LAYER_MAP, i] != null)
                {
                    if (segDef[mapSegment[LAYER_MAP,i].Index].Flags == (int)SegmentFlags.Torch)
                    {
                        particleManager.AddParticle(new Smoke(
                          mapSegment[LAYER_MAP,i].location * 2f + new Vector2(10f,13f),
                          RandomGenerator.GetRandomVector2(-50.0f, 50.0f, -300.0f, -200.0f),
                          1.0f,
                          0.8f,
                          0.6f,
                          1.0f,
                          RandomGenerator.GetRandomFloat(0.25f, 0.5f),
                          RandomGenerator.GetRandomInt(0, 4)), true);

                        particleManager.AddParticle(new Fire(
                            mapSegment[LAYER_MAP, i].location * 2f + new Vector2(10f, 37f),
                            RandomGenerator.GetRandomVector2(-30.0f, 30.0f, -250.0f, -200.0f),
                            RandomGenerator.GetRandomFloat(0.25f, 0.75f),
                            RandomGenerator.GetRandomInt(0, 4)), true);

                        // apparently heat is not the glowing orb I was looking for
                        particleManager.AddParticle(new Heat(mapSegment[LAYER_MAP, i].location * 2f
                             + new Vector2(10f, -37f),
                             RandomGenerator.GetRandomVector2(-50f, 50f, -400f, -300f),
                             RandomGenerator.GetRandomFloat(1f, 2f)));
                    }
                }
            }

            previousFrame = frame;
        }