Example #1
0
        public bool Equals(ref ExplosionHelper.Work w)
        {
            bool flag;
            bool flag1;

            if (this.squareDistanceToCenter == w.squareDistanceToCenter && this.boundsSquareDistance == w.boundsSquareDistance && this.boundsExtentSquareMagnitude == w.boundsExtentSquareMagnitude && this.distanceToCenter == w.distanceToCenter)
            {
                if (!this.rayTest)
                {
                    flag1 = !w.rayTest;
                }
                else
                {
                    flag1 = (!w.rayTest || this.squareRayDistance != w.squareRayDistance || this.rayDistance != w.rayDistance ? false : this.rayDir == w.rayDir);
                }
                if (!flag1 || !(this.center == w.center))
                {
                    flag = false;
                    return(flag);
                }
                flag = this.boundsExtent == w.boundsExtent;
                return(flag);
            }
            flag = false;
            return(flag);
        }
Example #2
0
 private bool BoundsWork(ref Bounds bounds, ref ExplosionHelper.Work w)
 {
     w.boundsSquareDistance = bounds.SqrDistance(this.point);
     if (w.boundsSquareDistance > (this.blastRadius * this.blastRadius))
     {
         return false;
     }
     if (w.boundsSquareDistance <= 1E-05f)
     {
         w.boundsSquareDistance = 0f;
     }
     w.center = bounds.center;
     w.rayDir.x = w.center.x - this.point.x;
     w.rayDir.y = w.center.y - this.point.y;
     w.rayDir.z = w.center.z - this.point.z;
     w.squareDistanceToCenter = ((w.rayDir.x * w.rayDir.x) + (w.rayDir.y * w.rayDir.y)) + (w.rayDir.z * w.rayDir.z);
     if (w.squareDistanceToCenter > (this.blastRadius * this.blastRadius))
     {
         return false;
     }
     if (w.squareDistanceToCenter <= 9.999999E-11f)
     {
         w.distanceToCenter = w.squareDistanceToCenter = 0f;
         w.rayDistance = w.squareRayDistance = 0f;
         w.rayTest = false;
         w.boundsExtent = bounds.size;
         w.boundsExtent.x *= 0.5f;
         w.boundsExtent.y *= 0.5f;
         w.boundsExtent.z *= 0.5f;
         w.boundsExtentSquareMagnitude = ((w.boundsExtent.x * w.boundsExtent.x) + (w.boundsExtent.y * w.boundsExtent.y)) + (w.boundsExtent.z * w.boundsExtent.z);
         return true;
     }
     w.distanceToCenter = Mathf.Sqrt(w.squareDistanceToCenter);
     w.boundsExtent = bounds.size;
     w.boundsExtent.x *= 0.5f;
     w.boundsExtent.y *= 0.5f;
     w.boundsExtent.z *= 0.5f;
     w.boundsExtentSquareMagnitude = ((w.boundsExtent.x * w.boundsExtent.x) + (w.boundsExtent.y * w.boundsExtent.y)) + (w.boundsExtent.z * w.boundsExtent.z);
     w.squareRayDistance = w.boundsSquareDistance + w.boundsExtentSquareMagnitude;
     if (w.squareRayDistance > w.squareDistanceToCenter)
     {
         w.squareRayDistance = w.squareDistanceToCenter;
         w.rayDistance = w.distanceToCenter;
     }
     else
     {
         if (w.squareRayDistance <= 9.999999E-11f)
         {
             w.rayDistance = w.squareRayDistance = 0f;
             w.rayTest = false;
             return true;
         }
         w.rayDistance = Mathf.Sqrt(w.squareRayDistance);
     }
     w.rayTest = true;
     return true;
 }
Example #3
0
        private bool BoundsWork(ref Bounds bounds, ref ExplosionHelper.Work w)
        {
            float single;

            w.boundsSquareDistance = bounds.SqrDistance(this.point);
            if (w.boundsSquareDistance > this.blastRadius * this.blastRadius)
            {
                return(false);
            }
            if (w.boundsSquareDistance <= 1E-05f)
            {
                w.boundsSquareDistance = 0f;
            }
            w.center = bounds.center;
            float   single1 = w.center.x;
            Vector3 vector3 = this.point;

            w.rayDir.x = single1 - vector3.x;
            float   single2  = w.center.y;
            Vector3 vector31 = this.point;

            w.rayDir.y = single2 - vector31.y;
            float   single3  = w.center.z;
            Vector3 vector32 = this.point;

            w.rayDir.z = single3 - vector32.z;
            w.squareDistanceToCenter = w.rayDir.x * w.rayDir.x + w.rayDir.y * w.rayDir.y + w.rayDir.z * w.rayDir.z;
            if (w.squareDistanceToCenter > this.blastRadius * this.blastRadius)
            {
                return(false);
            }
            if (w.squareDistanceToCenter <= 9.99999944E-11f)
            {
                float single4 = 0f;
                single = single4;
                w.squareDistanceToCenter = single4;
                w.distanceToCenter       = single;
                float single5 = 0f;
                single = single5;
                w.squareRayDistance           = single5;
                w.rayDistance                 = single;
                w.rayTest                     = false;
                w.boundsExtent                = bounds.size;
                w.boundsExtent.x              = w.boundsExtent.x * 0.5f;
                w.boundsExtent.y              = w.boundsExtent.y * 0.5f;
                w.boundsExtent.z              = w.boundsExtent.z * 0.5f;
                w.boundsExtentSquareMagnitude = w.boundsExtent.x * w.boundsExtent.x + w.boundsExtent.y * w.boundsExtent.y + w.boundsExtent.z * w.boundsExtent.z;
                return(true);
            }
            w.distanceToCenter            = Mathf.Sqrt(w.squareDistanceToCenter);
            w.boundsExtent                = bounds.size;
            w.boundsExtent.x              = w.boundsExtent.x * 0.5f;
            w.boundsExtent.y              = w.boundsExtent.y * 0.5f;
            w.boundsExtent.z              = w.boundsExtent.z * 0.5f;
            w.boundsExtentSquareMagnitude = w.boundsExtent.x * w.boundsExtent.x + w.boundsExtent.y * w.boundsExtent.y + w.boundsExtent.z * w.boundsExtent.z;
            w.squareRayDistance           = w.boundsSquareDistance + w.boundsExtentSquareMagnitude;
            if (w.squareRayDistance <= w.squareDistanceToCenter)
            {
                if (w.squareRayDistance <= 9.99999944E-11f)
                {
                    float single6 = 0f;
                    single = single6;
                    w.squareRayDistance = single6;
                    w.rayDistance       = single;
                    w.rayTest           = false;
                    return(true);
                }
                w.rayDistance = Mathf.Sqrt(w.squareRayDistance);
            }
            else
            {
                w.squareRayDistance = w.squareDistanceToCenter;
                w.rayDistance       = w.distanceToCenter;
            }
            w.rayTest = true;
            return(true);
        }
Example #4
0
 public bool Equals(ref ExplosionHelper.Work w)
 {
     return ((((((this.squareDistanceToCenter == w.squareDistanceToCenter) && (this.boundsSquareDistance == w.boundsSquareDistance)) && ((this.boundsExtentSquareMagnitude == w.boundsExtentSquareMagnitude) && (this.distanceToCenter == w.distanceToCenter))) && (!this.rayTest ? !w.rayTest : (((w.rayTest && (this.squareRayDistance == w.squareRayDistance)) && (this.rayDistance == w.rayDistance)) && (this.rayDir == w.rayDir)))) && (this.center == w.center)) && (this.boundsExtent == w.boundsExtent));
 }