private IEnumerator RemoveChild(CheckTopCollision col, GameObject obj) { //if there is a player child, then remove it from the parent and deactivate the collision box on top of clone if (col.isChild) { obj.transform.Find("Player").gameObject.transform.SetParent(null); obj.SetActive(false); col.isChild = false; yield return(new WaitForSeconds(.1f)); obj.SetActive(true); } }
private void RewindList(List <PointInTime> list) { if (list.Count > 0) { PointInTime pointInTime = list[0]; transform.position = pointInTime.position; transform.rotation = pointInTime.rotation; list.RemoveAt(0); } else { GameObject obj = transform.Find("TopCollider").gameObject; GameObject triggerBox = obj.transform.Find("TriggerBox").gameObject; CheckTopCollision col = triggerBox.GetComponent <CheckTopCollision>(); StartCoroutine(RemoveChild(col, obj)); rb.isKinematic = false; switchList = !switchList; } }