Пример #1
0
    internal override void Init(Animator animator)
    {
        base.Init(animator);

        for (int i = 0; i < m_Attacks.Length; i++)
        {
            m_Attacks[i].triggers = new PEAttackTrigger[m_Attacks[i].bones.Length];
            for (int j = 0; j < m_Attacks[i].bones.Length; j++)
            {
                Transform tr = PEUtil.GetChild(animator.transform, m_Attacks[i].bones[j]);
                if (tr != null)
                {
                    PEAttackTrigger attackTrigger = tr.GetComponent <PEAttackTrigger>();
                    if (null != attackTrigger)
                    {
                        m_Attacks[i].triggers[j] = attackTrigger;
                    }
                    else
                    {
                        Debug.LogError("Can't find PEAttackTrigger:" + m_Attacks[i].bones[j]);
                    }
                }
                else
                {
                    Debug.LogError("Can't find bone:" + m_Attacks[i].bones[j]);
                }
            }
        }
    }
Пример #2
0
        public Transform GetChild(string boneName)
        {
            if (string.IsNullOrEmpty(boneName) || "0" == boneName)
            {
                return(null);
            }

            Transform child;
            int       nameHash = boneName.GetHashCode();

            if (m_TransDic.ContainsKey(nameHash))
            {
                child = m_TransDic[nameHash];
                if (null != child)
                {
                    return(child);
                }
            }

            if (null != biologyViewCmpt && null != biologyViewCmpt.modelTrans)
            {
                child = PEUtil.GetChild(biologyViewCmpt.modelTrans, boneName);
            }
            else
            {
                child = PEUtil.GetChild(transform, boneName);
            }
            if (null != child)
            {
                m_TransDic[nameHash] = child;
            }
            return(child);
        }
    internal override void Init(Animator animator)
    {
        base.Init(animator);

        m_Triggers = new PEAttackTrigger[0];

        foreach (string bone in bones)
        {
            Transform tr = PEUtil.GetChild(animator.transform, bone);
            if (tr != null)
            {
                PEAttackTrigger attackTrigger = tr.GetComponent<PEAttackTrigger>();
				if(null != attackTrigger)
                {
                    System.Array.Resize(ref m_Triggers, m_Triggers.Length+1);
                    m_Triggers[m_Triggers.Length - 1] = attackTrigger;
                }
            }
        }
    }