Exemple #1
0
 private void DetachFromParentChain()
 {
     if (m_ParentChain != null)
     {
         m_ParentChain         = null;
         m_Joint.connectedBody = null;
     }
 }
Exemple #2
0
    private void AttachToParentChain(LigamentChain parent)
    {
        Debug.AssertFormat(m_ParentChain == null, "AttachToParent when parent already set");
        if (m_ParentChain == null)
        {
            m_ParentChain = parent;

            m_Joint.connectedBody = parent.m_Body;
            //m_Joint.targetRotation = m_BaseRotation;

            m_Joint.autoConfigureConnectedAnchor = true;
            m_Body.position = transform.position = parent.m_BoneEnd.position - (m_BoneStart.position - transform.position);

            m_Joint.configuredInWorldSpace = false;
            m_Joint.connectedAnchor        = parent.m_BoneEnd.position - transform.position;
            //m_Joint.anchor = parent.m_BoneEnd.position - transform.position;
        }
    }
Exemple #3
0
    private Transform BuildCreature(Transform headTemplate)
    {
        Transform builtCreatureRoot = BuildHead(headTemplate);
        Rigidbody parentRigidNumber = builtCreatureRoot.GetComponent <Rigidbody>();

        int childCount = headTemplate.childCount;

        for (int i = 0; i < childCount; i++)
        {
            Transform childTemplate = headTemplate.GetChild(i);

            if (childTemplate.TryGetComponent(out Ligament ligament))
            {
                Transform      newLigament       = BuildLigament(childTemplate, builtCreatureRoot);
                LimbController newLimbController = MakeLimbRoot(newLigament, parentRigidNumber);
                LigamentChain  endJoint          = BuildRestOfLimb(childTemplate, newLigament);

                newLimbController.BuildLimb(endJoint);
            }
        }

        return(builtCreatureRoot);
    }
Exemple #4
0
 private void Start()
 {
     m_LigamentChain = GetComponent <LigamentChain>();
     m_CurrentHealth = m_MaxHealth;
 }