Пример #1
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;
        }
Пример #2
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
                        );
                    }
                }
            }
        }