Esempio n. 1
0
 public ScaleUp(string texPath, Vector2 origin, float layerDepth,
                Vector2 pos, RadiusFunc radiusFunc, SingleFunc rotaFunc,
                float duration)
 {
     this.tex        = BaseGame.ContentMgr.Load <Texture2D>(texPath);
     this.origin     = origin;
     this.pos        = pos;
     this.radiusFunc = radiusFunc;
     this.rotaFunc   = rotaFunc;
     this.duration   = duration;
     this.layerDepth = layerDepth;
     EffectsMgr.AddManagedEffect(this);
 }
Esempio n. 2
0
        public SmokeGenerater(float duaration, float partiDuara, Vector2 pos, Vector2 dir, float speed, float concen, bool managered)
        {
            this.duaration = duaration;
            this.concen    = concen;

            Texture2D tex = BaseGame.ContentMgr.Load <Texture2D>(texAsset);

            particleSystem = new ParticleSystem(duaration, partiDuara, pos, tex, texOrigin, null, LayerDepth.EffectLow + 0.01f,
                                                delegate(float curTime, ref float timer)
            {
                if (this.concen == 0)
                {
                    return(0);
                }
                else if (this.concen > 1)
                {
                    return((int)(this.concen));
                }
                else if (curTime % (int)(1 / this.concen) == 0)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            },
                                                delegate(float curTime, float deltaTime, Vector2 lastPos, Vector2 curDir, int No)
            {
                if (curTime == 0)
                {
                    return(Vector2.Zero + RandomHelper.GetRandomVector2(-1, 1));
                }

                else
                {
                    return(lastPos + curDir * speed);
                }
            },
                                                delegate(float curTime, float deltaTime, Vector2 lastDir, int No)
            {
                if (curTime == 0)
                {
                    return(dir + RandomHelper.GetRandomVector2(-0.3f, 0.3f));
                }

                else
                {
                    return(lastDir);
                }
            },
                                                delegate(float curTime, float deltaTime, float lastRadius, int No)
            {
                return(startRadius * (1 + 0.1f * curTime));
            },
                                                delegate(float curTime, float deltaTime, Color lastColor, int No)
            {
                return(new Color(160, 160, 160, Math.Max((byte)0, (byte)(255 * (partiDuara - curTime) / partiDuara))));
            });

            if (managered)
            {
                EffectsMgr.AddManagedEffect(this);
            }
        }