Esempio n. 1
0
        public LYRagdoll Enable(GameObject obj_)
        {
            string name = obj_.name.ToLower();

            name = name.Replace("(clone)", "");

            LYRagdoll rd = obj_.GetComponentInChildren <LYRagdoll>();

            if (rd != null)
            {
                rd.enabled = true;
                return(rd);
            }

            templateItemD template = GetTemplateItem(name);

            if (template == null)
            {
                return(null);
            }
            ItemD item = template != null?GetNodeItemByTemplateName(template.templateName) : GetNodeItemDByObj(obj_);

            if (item == null)
            {
                return(null);
            }

            rd = obj_.AddComponent <LYRagdoll>();
            rd.LoadFromNode(item, template);
            rd.OnEnable();

            return(rd);
        }
Esempio n. 2
0
        public void Disable(GameObject obj_)
        {
            LYRagdoll rd = obj_.GetComponentInChildren <LYRagdoll>();

            if (rd != null)
            {
                rd.enabled = false;
            }
        }
Esempio n. 3
0
        public void Clear(GameObject obj_)
        {
            LYRagdoll rd = obj_.GetComponentInChildren <LYRagdoll>();

            if (rd == null)
            {
                return;
            }
            rd.Clear();
        }
Esempio n. 4
0
        public bool BEnable(GameObject obj_)
        {
            LYRagdoll rd = obj_.GetComponentInChildren <LYRagdoll>();

            if (rd == null)
            {
                return(false);
            }
            return(rd.enabled);
        }
Esempio n. 5
0
        public void EnableByNodeItem(GameObject obj_, string nodeItemName_)
        {
            LYRagdoll rd = obj_.GetComponentInChildren <LYRagdoll>();

            if (rd != null)
            {
                rd.enabled = false;
            }

            ItemD item = GetNodeItemByTemplateName(nodeItemName_);

            if (item == null)
            {
                return;
            }

            if (rd == null)
            {
                rd = obj_.AddComponent <LYRagdoll>();
            }
            rd.LoadFromNode(item, null);
            rd.OnEnable();
        }