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; } } } }
//update Function for Released MODE void updateReleaseMotion(float dt) { //it was supposed to check if (ImageUITouch.HitObject == this.gameObject) { #if UNITY_EDITOR attachToUI(); scale.x = 0.15f; scale.y = 0.19f; scale.z = 0.03f; #elif UNITY_IPHONE if (ImageUITouch.Force < 5.0f) { scale.x = 0.15f * Mathf.Max(1.0f, ImageUITouch.Force) * 0.5f; scale.y = 0.19f * Mathf.Max(1.0f, ImageUITouch.Force) * 0.5f; scale.z = 0.03f; } else { attachToUI(); scale.x = 0.15f; scale.y = 0.19f; scale.z = 0.03f; } #endif } else { scale.x = 0.15f; scale.y = 0.19f; scale.z = 0.03f; } if (this.transform.localPosition.y < -1.0) { this.Remove(); ImageUIObjectsManager.SetLeft(this.gameObject); } this.transform.localScale += (scale - this.transform.localScale) * dt * 10.0f; }