Esempio n. 1
0
 private void GetHitResults()
 {
     hitResults.Clear();
     for (int m = 0; m < entities.Count; m++)
     {
         var e1 = entities[m];
         for (int n = 0; n < entities.Count; n++)
         {
             var e2 = entities[n];
             if (e1 == e2)
             {
                 continue;
             }
             if (!(e1 is Unit) || !(e2 is Unit))
             {
                 continue;
             }
             var attacker = e1 as Unit;
             var target   = e2 as Unit;
             if (attacker.GetMoveType() != MoveType.Attack || attacker.GetHitDefData() == null || attacker.GetHitDefData().moveContact == true)
             {
                 continue;
             }
             if (attacker is Helper && (attacker as Helper).owner == target)
             {
                 continue;
             }
             var collider1 = attacker.moveCtr.collider;
             var collider2 = target.moveCtr.collider;
             for (int i = 0; i < collider1.attackClsnsLength; i++)
             {
                 var attackClsn = collider1.attackClsns[i];
                 for (int j = 0; j < collider2.defenceClsnsLength; j++)
                 {
                     var         defenceClsn = collider2.defenceClsns[j];
                     ContactInfo contactInfo;
                     if (PhysicsUtils.RectColliderIntersectTest(attackClsn, defenceClsn, out contactInfo))
                     {
                         hitResults[target] = attacker;
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public virtual bool IsIntersect(Collider c, out ContactInfo contactInfo)
 {
     contactInfo = null;
     return(PhysicsUtils.IsIntersect(this, c, out contactInfo));
 }