示例#1
0
 public void UnDivide()
 {
     if (!parent)
     {
         Debug.LogError(uid + " has no parent, cannot un divide");
     }
     else
     {
         if (children != null)
         {
             Debug.LogError(uid + " has children, Undivide should be called on the children");
             return;
         }
         else
         {
             for (int i = 0; i < parent.children.Count; i++)
             {
                 var child = parent.children[i];
                 GameObject.Destroy(child.gameObject);
                 Debug.Log(string.Format("{0} removed children: {1}", parent.uid, child.uid));
             }
             parent.children = null;
             parent.go.SetActive(true);
             parent.GetComponent <BoxCollider>().enabled = true;
         }
     }
 }
示例#2
0
 // Start is called before the first frame update
 void Start()
 {
     module  = gameObject.GetComponent <LeModule>();
     lengths = new float[] {
         module.size.x / 2,
         module.size.x / 2,
         module.size.y / 2,
         module.size.y / 2,
         module.size.z / 2,
         module.size.z / 2
     };
     active = module.GetComponent <ModuleMove>().active;
 }