Exemple #1
0
Fichier : ED.cs Projet : THSJF/sjf
 private void Praticle1Update(SimplePraticle item)
 {
     if (item.time == 1)
     {
         item.values.Add("alpha", 1f);
     }
     item.position.Y += 2f;
     item.position.X -= 1.4f;
     item.rotate     += 3f;
     item.scale.X     = item.oscale.X * Math.Abs((float)Math.Sin((double)MathHelper.ToRadians((float)(item.time * 2))));
     if ((double)item.position.Y >= 480.0)
     {
         Dictionary <string, float> values;
         (values = item.values)["alpha"] = values["alpha"] - 0.01f;
         if ((double)item.values["alpha"] <= 0.0)
         {
             item.NeedDis = true;
         }
     }
     if (this.time > 2200 && this.time <= 2300)
     {
         Dictionary <string, float> values;
         (values = item.values)["alpha"] = values["alpha"] - 0.015f;
         if ((double)item.values["alpha"] <= 0.0)
         {
             item.NeedDis = true;
         }
     }
     if (this.time < 1820 || this.time > 2300)
     {
         return;
     }
     item.alpha = item.values["alpha"];
 }
Exemple #2
0
 public void Update()
 {
     if (this.ifemit)
     {
         ++this.time;
         if (this.time % this.emitcycle == 0)
         {
             for (int index = 0; index < this.emitdensity; ++index)
             {
                 SimplePraticle simplePraticle = new SimplePraticle(this.image, this.imagerect, this.imageanchor);
                 simplePraticle.position = new Vector2(this.emitcenter.X + MathHelper.Lerp(-this.emitrange.X, this.emitrange.X, (float)Main.rand.NextDouble()), this.emitcenter.Y + MathHelper.Lerp(-this.emitrange.Y, this.emitrange.Y, (float)Main.rand.NextDouble()));
                 simplePraticle.alpha    = this.praticlealpha + MathHelper.Lerp(this.alpharange.X, this.alpharange.Y, (float)Main.rand.NextDouble());
                 double num1 = (double)MathHelper.Lerp(this.rotaterange.X, this.rotaterange.Y, (float)Main.rand.NextDouble());
                 simplePraticle.rotate = this.praticlerotate;
                 float num2 = MathHelper.Lerp(this.scalerange.X, this.scalerange.Y, (float)Main.rand.NextDouble());
                 simplePraticle.scale = new Vector2(this.praticlescale.X + num2, this.praticlescale.Y + num2);
                 simplePraticle.Backup(simplePraticle.position, simplePraticle.alpha, simplePraticle.rotate, simplePraticle.scale);
                 this.box.Add(simplePraticle);
             }
         }
     }
     for (int index = 0; index < this.box.Count; ++index)
     {
         if (!this.box[index].NeedDis)
         {
             this.box[index].Update(this.itemupdate);
         }
         else
         {
             this.box.RemoveAt(index);
             --index;
         }
     }
 }