private void watchPosition() { if (rotation.z > maxLimit + eachDistance * 0.5f) { GameObject go = this.transform.childCount == 0 ? null : this.transform.GetChild(0).gameObject; ImageUIObjectsManager.SetLeft(go); GameObject imageObject = ImageUIObjectsManager.GetRight(this.transform); rotation.z -= sideLength; rotationTarget.z -= sideLength; } if (rotation.z < minLimit - eachDistance * 0.5f) { GameObject go = this.transform.childCount == 0 ? null : this.transform.GetChild(0).gameObject; ImageUIObjectsManager.SetRight(go); GameObject imageObject = ImageUIObjectsManager.GetLeft(this.transform); rotation.z += sideLength; rotationTarget.z += sideLength; } float targ = Mathf.Round(rotation.z / 4.5f); ID = (int)(targ + 10) % 7; }
//Check that ImageObject is in this wrapper void watchChild() { if (this.transform.childCount == 0) { if (ID == 0) { GameObject imageObject = ImageUIObjectsManager.GetLeft(this.transform); // Instantiate (ImagePrefab, this.transform); } else if (ID == 6) { GameObject imageObject = ImageUIObjectsManager.GetRight(this.transform); } else { if (RightWrapper.childCount != 0) { RightWrapper.GetChild(0).parent = this.transform; } } } else if (this.transform.childCount > 1) { if (ID == 0) { ImageUIObjectsManager.SetRight(this.transform.GetChild(0).gameObject); // GameObject.Destroy (); } else if (ID == 6) { ImageUIObjectsManager.SetLeft(this.transform.GetChild(0).gameObject); } else { if (RightWrapper.childCount != 0) { this.transform.GetChild(0).parent = RightWrapper; } } } }