Ejemplo n.º 1
0
 public void LoseStrengthChildren(float loseStrength, Transform ignoreChild = null)
 {
     loseStrength *= strengthLoseFalloff;
     foreach (Transform item in transform)
     {
         if (ignoreChild != item)
         {
             RagdollBodyPart child = item.GetComponent <RagdollBodyPart>();
             if (child)
             {
                 child.LoseStrength(loseStrength);
                 child.LoseStrengthChildren(loseStrength);
             }
         }
     }
 }
Ejemplo n.º 2
0
    public void LoseStrengthParents(float loseStrength, Transform currentTransform)
    {
        RagdollBodyPart parentScript = currentTransform.parent.GetComponent <RagdollBodyPart>();

        if (!parentScript)
        {
            return;
        }

        parentScript.LoseStrength(loseStrength);

        loseStrength *= strengthLoseFalloff;

        parentScript.LoseStrengthChildren(loseStrength, currentTransform);

        LoseStrengthParents(loseStrength, currentTransform.parent);
    }