示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject baseblock = transform.GetChild(1).GetChild(0).gameObject;

        hierarchy = new SwordHierarchyTree(baseblock, baseblock.transform.position, baseblock.transform.rotation, null);
        transform.GetChild(1).GetChild(0).GetComponent <swordHierarchyNode>().add(hierarchy);
    }
 public SwordHierarchyTree(GameObject g, Vector3 pos, Quaternion rot, SwordHierarchyTree p)
 {
     block    = g;
     position = pos;
     rotation = rot;
     parent   = p;
     if (p != null)
     {
         p.addChild(this);
     }
 }
 public void addChild(SwordHierarchyTree c)
 {
     children.Add(c);
 }
 public void add(SwordHierarchyTree s)
 {
     self = s;
 }