public void UnLink2MountPoint() { //与这个节点相连的节点实例的节点信息被清理: if (link_mount_point != null) { Debug.Log("即将清理的外部节点的名字是" + link_mount_point.name); link_mount_point.link_info[0] = -999; link_mount_point.link_info[1] = -999; link_mount_point.link_mount_point = null; link_mount_point.link_part = null; StartCoroutine(link_mount_point.CleanLastMP()); } //这个零件的所有子零件不再以这个零件为父零件,并且直接挂到 Unit 下: //foreach (Part child_part in self_root_part.child_part) //{ // child_part.parent_part = null; // //child_part.transform.SetParent(unit_blueprint.transform); //} //开启容差时间的协程: if (link_mount_point != null) { link_mount_point_last = link_mount_point; StartCoroutine(CleanLastMP()); } //这个节点自身的信息被清理: link_mount_point = null; link_info[0] = -999; link_info[1] = -999; //自身节点的连接零件引用被置空: link_part = null; //自身零件的父级零件的子零件列表中移除自身: //////////if (self_root_part.parent_part != null && !self_root_part.parent_part.child_part.Contains(self_root_part)) //////////{ ////////// //如果自身的父零件不为null,但是父零件的子零件列表中找不到自身,报出严重错误 ////////// Debug.Log("严重错误:要移除的零件的 父级零件的子集零件列表 中没有当前零件!"); //////////} //////////else if(self_root_part.parent_part != null) //////////{ ////////// self_root_part.parent_part.child_part.Remove(self_root_part); //////////} //自身零件的父级零件被置空: self_root_part.parent_part = null; //把自身零件挂在设计平台的 Unit 下 self_root_part.transform.SetParent(unit_blueprint.transform); Debug.LogError("归属于" + self_root_part.name + "的节点" + ID + "已经断开连接"); self_root_part.link_audio.Play(); }