Пример #1
0
    private void DropWeapon(WeaponHand type)
    {
        if (m_Weapons.ContainsKey(type))
        {
            GameObject weapon = m_Weapons[type];
            Script_Util.DetachGameObject(weapon);
            GameObject.DestroyObject(weapon);
            m_Weapons.Remove(type);
        }

        // Make Sure Remove All Children
        Transform t = LogicSystem.FindChildRecursive(this.gameObject.transform, GetBoneName(type));

        if (t != null)
        {
            int childCount = t.childCount;
            for (int index = 0; index < childCount; index++)
            {
                Transform child = t.GetChild(index);
                child.parent = null;
                GameObject.Destroy(child.gameObject);
            }
            t.DetachChildren();
        }
    }