public void Orphanize() { this.transform.parent = null; attached = false; parent = ParentedObj.None; pushDir = PushDirection.None; parentTransform = null; }
void ParentToHitTarget(Transform hit, PushDirection pushdirec) { if (hit.transform != null) { if (hit.transform.tag == "Tree") { if (Vector3.Distance(Vector3.Normalize(transform.position - hit.transform.parent.transform.position), hit.transform.parent.up) < 0.1f) { if (hit.transform.parent.GetComponent<PillarController>().grow && !hit.transform.parent.GetComponent<PillarController>().atMaxHeight) { this.transform.parent = hit.transform.parent.transform.GetChild(0); parent = ParentedObj.Pillar; parentTransform = this.transform.parent; attached = true; pushDir = pushdirec; } } } else if (hit.transform.tag == "Kid") { // Debug.Log (hit.transform.name); // if (hit.transform.GetComponent<CharController6>().channel == 0) { //if (hit.transform.GetComponent<CharController6>().nextNode == node) { // if (Vector3.Angle(hit.transform.forward, new Vector3(transform.position.x, 0f, transform.position.z) - new Vector3(hit.transform.position.x, 0f, hit.transform.position.z)) < 2.5f) { this.transform.parent = hit.transform.GetChild(1); parent = ParentedObj.Kid; parentTransform = this.transform.parent; attached = true; pushDir = pushdirec; // } // } } } }