示例#1
0
 /// <summary>
 /// Returns the index of the first (ie lowest numbered)
 /// sprite it colides with -1 if no collision
 /// the self parameter is there to allow the avoidance of collision texting against yourself
 /// </summary>
 /// <param name="s">the sprite to test the list against</param>
 /// <param name="self">the number of a single sprite to avoid testing</param>
 /// <returns></returns>
 public int collisionAA(Sprite3 s, int self)
 {
     if (s == null)
     {
         return(-1);
     }
     if (!s.getVisible())
     {
         return(-1);
     }
     if (!s.getActive())
     {
         return(-1);
     }
     for (int i = 0; i < highUsed + 1; i++)
     {
         if (sprite[i] != null && sprite[i].active)
         {
             if (sprite[i].getVisible() &&
                 i != self && s.collision(sprite[i]))
             {
                 return(i);
             }
         }
     }
     return(-1);
 }