ProjectStorms.ShipPartDestroy.EvaluatePartCollision C# (CSharp) Method

EvaluatePartCollision() public method

Evaluates the collision with the input collider.
public EvaluatePartCollision ( Collider a_otherCol, float a_colVelSqr ) : void
a_otherCol UnityEngine.Collider
a_colVelSqr float Squared relative collision velocity magnitude.
return void
        public void EvaluatePartCollision(Collider a_otherCol, float a_colVelSqr)
        {
            // Find the part being collided with
            Collider[] childColliders;
            foreach (ShipPart part in destructableParts)
            {
                childColliders = part.partObject.GetComponentsInChildren<Collider>();
                foreach (Collider col in childColliders)
                {
                    // Check if the collision actually involves the part
                    if (col == a_otherCol)
                    {
                        //Debug.Log("Colliding with: " + col + ", part : " + part.partObject.name);
                        //Debug.Log(colVelSqr);

                        ApplyPartCollision(part, a_colVelSqr);

                        // Collision has evaluated, return back to OnCollisionEnter
                        return;
                    }
                }
            }
        }