コード例 #1
0
 /// <summary>
 /// 更新粒子物理属性,如果粒子超过边界,将其回收
 /// </summary>
 /// <param name="elapsedTime"></param>
 /// <param name="size"></param>
 public void Update(float elapsedTime, Vector2 size)
 {
     {
         if (surfaceLoaded)
         {
             for (int i = ActiveParticles.Count - 1; i >= 0; i--)
             {
                 var p = ActiveParticles[i];
                 if (p == null)
                 {
                     ActiveParticles.RemoveAt(i);
                     return;
                 }
                 if (p.Position.X > 0 - size.Y * (float)Math.Tan(1.5708 - (minRotationAngle + maxRotationAngle) / 2) && p.Position.X <= size.X && p.Position.Y <= size.Y)
                 {
                     p.Update(elapsedTime);
                 }
                 else
                 {
                     ActiveParticles.RemoveAt(i);
                     FreeParticles.Push(p);
                 }
             }
         }
     }
 }
コード例 #2
0
 internal void ImmersiveOut()
 {
     inited = false;
     for (int i = ActiveParticles.Count - 1; i >= 0; i--)
     {
         var p = ActiveParticles[i];
         ActiveParticles.RemoveAt(i);
         FreeParticles.Push(p);
     }
     isImmersive = false;
 }
コード例 #3
0
 /// <summary>
 /// 更新粒子物理属性,如果粒子超过边界,将其回收
 /// </summary>
 /// <param name="elapsedTime"></param>
 /// <param name="size"></param>
 public void Update(float elapsedTime, Vector2 size)
 {
     if (surfaceLoaded)
     {
         for (int i = ActiveParticles.Count - 1; i >= 0; i--)
         {
             var p = ActiveParticles[i];
             if (p == null)
             {
                 ActiveParticles.RemoveAt(i);
                 return;
             }
             if (p.Position.X < (size.X + (surfacesBounds[p.Key].Width) / 2))
             {
                 p.Update(elapsedTime);
             }
             else
             {
                 ActiveParticles.RemoveAt(i);
                 FreeParticles.Push(p);
             }
         }
     }
 }