示例#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]);
                }
            }
        }
    }
    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;
                }
            }
        }
    }