Exemplo n.º 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.PerticelPower = 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();
 }
Exemplo n.º 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.PerticelPower = Vector2.Zero;
     this.ParticelSize = 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;
 }
Exemplo n.º 3
0
        public void Update(GameTime time, BewegungsHandler bewegung)
        {
            // Console.WriteLine(lifeTime);
            randome = r.Next(100, 500);
            if ((time.TotalGameTime.Milliseconds % randome) == 0) currentVelocity = bewegung.move(profil, power, velocity);
            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;

            /* Console.WriteLine("Stayon:"+stayOnMax);
             Console.WriteLine("down:" + down);
             Console.WriteLine("up:" + up);
             Console.WriteLine("percent:" + percent);
             Console.WriteLine();*/

            this.angular += angularVelocity;
            this.pos += currentVelocity * power;
            percent = currentLife / lifeTime;
        }