private void DisintegrateChildren() { foreach (Transform child in gameObject.transform) { GameObject cobj = child.gameObject; // Get the HierHandler HierHandler hh = cobj.GetComponent <HierHandler>(); if (hh != null) { hh.Disintegrate(); } } }
private void SplitChildren(Collision collision) { foreach (Transform child in gameObject.transform) { GameObject cobj = child.gameObject; // Get the HierHandler HierHandler hh = cobj.GetComponent <HierHandler>(); if (hh != null) { hh.Collision(collision); } } }
public void Initialize() { if (!this.isLeaf) { this.c1hh = c1.GetComponent <HierHandler>(); this.c2hh = c2.GetComponent <HierHandler>(); } this.originalPosition = gameObject.transform.localPosition; this.originalEuler = gameObject.transform.localEulerAngles; this.originalScale = gameObject.transform.localScale; this.pos = this.handler.position; }
public void Enable() { gameObject.SetActive(true); foreach (Transform child in gameObject.transform) { GameObject childObj = child.gameObject; // If the child has HierHandler, call Enable on it HierHandler chh = childObj.GetComponent <HierHandler>(); if (chh != null) { chh.Enable(); } } }
public void Initialize(Environment environment, Position position) { this.environment = environment; this.position = position; this.active = new Stack <GameObject>(this.nrOfLeaves); this.deactive = new Stack <GameObject>(this.nrOfLeaves); for (int i = 0; i < this.nrOfLeaves; ++i) { GameObject newPhys = Instantiate(this.phys); newPhys.SetActive(false); AstePhys p = newPhys.GetComponent <AstePhys>(); p.position = position; p.environment = environment; p.handler = this; this.active.Push(newPhys); } this.rootHandler = root.GetComponent <HierHandler>(); }
public void Reset() { RestoreTransform(); // Disable recursively foreach (Transform child in gameObject.transform) { GameObject childObj = child.gameObject; // If the child has HierHandler, recurse HierHandler chh = childObj.GetComponent <HierHandler>(); if (chh != null) { chh.Reset(); } } // Disable component this.enabled = false; // Disable self gameObject.SetActive(false); }