Ejemplo n.º 1
0
 static void Init(RaySegmentsCollisionInfo[] info)
 {
     for (int index = 0; index < info.Length; ++index)
     {
         info[index] = new RaySegmentsCollisionInfo();
     }
 }
Ejemplo n.º 2
0
 static void Init(RaySegmentsCollisionInfo[] info)
 {
     for (int index = 0; index < info.Length; ++index)
     {
         info[index] = new RaySegmentsCollisionInfo();
     }
 }
Ejemplo n.º 3
0
 static void Reset(RaySegmentsCollisionInfo[] info)
 {
     for (int index = 0; index < info.Length; ++index)
     {
         info[index].distance = -1;
         info[index].body = null;
     }
 }
Ejemplo n.º 4
0
        void OnCollided(object sender, CollisionEventArgs e)
        {
            RaySegmentIntersectionInfo info = e.CustomCollisionInfo as RaySegmentIntersectionInfo;

            if (info != null)
            {
                ReadOnlyCollection <Scalar> distances = info.Distances;

                for (int index = 0; index < next.Length; ++index)
                {
                    RaySegmentsCollisionInfo cinfo = next[index];
                    if (distances[index] != -1 && (cinfo.distance == -1 || distances[index] < cinfo.distance))
                    {
                        cinfo.body     = e.Other;
                        cinfo.distance = distances[index];
                    }
                }
            }
        }