示例#1
0
 public Emitter(List<Texture2D> texture, Vector2 pos, Texture2D EmitterTexture, Effect color, Vector2 particelSize, Vector2 particelPower, List<Vector2> emitterAngel, Vector2 emitterRange, float particelAmount, float spawnTime, float startParticel, Vector2 lifeDrain, Vector2 lifeTime, Vector2 stayOnMax, Bewegungsprofile bewegung, Spawnprofile spawnprofile)
 {
     this.ParticelStayOnMax = stayOnMax;
     this.spawnprofile = spawnprofile;
     this.startParticel = startParticel;
     this.bewegung = new BewegungsHandler();
     this.ParticelLifeTime = lifeTime;
     this.ParticelLifeDrain = lifeDrain;
     this.EmitterAngel = emitterAngel;
     this.EmitterRange = emitterRange;
     this.EmitterTexture = EmitterTexture;
     this.Position = pos;
     this.ParticelSize = particelSize;
     this.ParticelTexture = texture;
     this.particels = new List<Particel>();
     this.ParticelMass = particelPower;
     this.ParticelSize = particelSize;
     this.r = new Random();
     this.color = color;
     this.EmitterMaxParticel = particelAmount;
     this.EmitterUpdate = spawnTime;
     this.Origin = new Vector2(this.EmitterTexture.Width / 2, this.EmitterTexture.Height / 2);
     this.bewegungsprofil = bewegung;
     this.go = false;
     Start();
 }
示例#2
0
 public Emitter(Vector2 pos,DebugFlag flag)
 {
     this.debugFlag = flag;
     this.stringBuilder = new StringBuilder();
     this.particelPerUpdate = Vector2.Zero;
     this.ParticelStayOnMax = Vector2.Zero;
     this.bewegung = new BewegungsHandler();
     this.ParticelLifeTime = Vector2.Zero;
     this.ParticelLifeDrain = Vector2.Zero;
     this.EmitterAngel = new List<Vector2>() { Vector2.Zero };
     this.EmitterRange = Vector2.Zero;
     this.EmitterTexture = null;
     this.Position = pos;
     this.ParticelSize = Vector2.Zero;
     this.ParticelTexture = new List<Texture2D>();
     this.particels = new List<Particel>();
     this.ParticelMass = Vector2.Zero;
     this.ParticelSize = Vector2.Zero;
     this.ParticelPower = Vector2.Zero;
     this.r = new Random();
     this.color = null;
     this.EmitterMaxParticel = 0f;
     this.EmitterUpdate = 0f;
     //  this.Origin = new Vector2(this.EmitterTexture.Width / 2, this.EmitterTexture.Height / 2);
     this.bewegungsprofil = Bewegungsprofile.Linear;
     this.go = false;
 }
示例#3
0
        public void Update(GameTime time, BewegungsHandler bewegung)
        {
            this.time += time.ElapsedGameTime.Milliseconds;

            if (this.time > timer + randome)
            {
                randome = r.Next(100, 500);
                this.timer = this.time;
                Vector2 force = bewegung.move(profil, velocity,agility,power);
                velocity =  (force / mass);
            }
            if (currentLife == lifeTime && stayOnMax > 0) { down = false; up = false; }
            if (!down && !up) stayOnMax -= time.ElapsedGameTime.Milliseconds * drainLife;
            if (stayOnMax <= 0 && !down && !up) down = true;

            if (down) currentLife -= time.ElapsedGameTime.Milliseconds * drainLife;
            else if (up) currentLife += time.ElapsedGameTime.Milliseconds * drainLife;

            this.angular += angularVelocity;
            this.pos += velocity;
            percent = currentLife / lifeTime;
        }