public void RemoveChild(FOBJ c) { bool remove = false; int index = 0; for (int i = 0; i < Child.Length; i++) { if (Child[i] == c) { remove = true; index = i; break; } } if (!remove) { return; } FOBJ [] newchild = new FOBJ[Child.Length - 1]; int a = 0; for (int i = 0; i < index; i++) { newchild[a] = Child[i]; a++; } for (int x = index + 1; x < Child.Length; x++) { newchild[a] = Child[x]; a++; } Child = newchild; }
public virtual void Init(int ind, FOBJ p, params float [] args) { if (ind != -1) { Index = ind; } Parent = p; if (Name == string.Empty) { Name = gameObject.name; } else { gameObject.name = Name; } for (int i = 0; i < Child.Length; i++) { if (Child[i] == null) { continue; } Child[i].Init(i, this); } if (SetInactiveAfterLoading) { SetActive(false); } else { isActive = this.gameObject.activeSelf; } }
public override void Init(int ind, FOBJ p, params float [] args) { base.Init(ind, p, args); if (SVG.Length == 0 && GetComponent <SVGRenderer>()) { SVG = new SVGRenderer[] { GetComponent <SVGRenderer>() } } ; if (Text.Length == 0 && GetComponent <TextMeshPro>()) { Text = new TextMeshPro[] { GetComponent <TextMeshPro>() } } ; } } }
public void AddChild(params FOBJ [] c) { FOBJ [] newchild = new FOBJ[Child.Length + c.Length]; for (int i = 0; i < Child.Length; i++) { newchild[i] = Child[i]; } int x = 0; for (int i = Child.Length; i < Child.Length + c.Length; i++) { newchild[i] = c[x]; newchild[i].Init(i, this); newchild[i].transform.SetParent(this.transform, false); newchild[i].transform.localRotation = Quaternion.identity; newchild[i].transform.localPosition = Vector3.zero; newchild[i].transform.localScale = Vector3.one; x++; } Child = newchild; }
public void SetParent(FOBJ f) { f.AddChild(this); }