public void UpdateScale() { if (containerPlayerDisplay == null) { return; } if (containerPlayerDisplay.transform.childCount == 0) { return; } if (containerRotator == null) { return; } string keyScale = "scale-" + uuid; if (AnimationEasing.EaseExists(keyScale)) { AnimationEasing.AnimationItem aniItem = AnimationEasing.EaseGet(keyScale); currentContainerScale = aniItem.val;//AnimationEasing.EaseGetValue(keyScale, 1.0f); if (currentContainerScale != scaleMax || currentContainerScale != scaleMin) { currentContainerScale = (double)Mathf.Clamp((float)currentContainerScale, (float)scaleMin, (float)scaleMax); //Debug.Log("UpdateScale:" + " currentContainerScale:" + currentContainerScale); float scaleTo = (float)currentContainerScale; float zoomAdjustY = 0f; containerRotator.transform.localScale = Vector3.zero .WithX(scaleTo) .WithY(scaleTo) .WithZ(scaleTo); zoomAdjustY = -(Mathf.Abs((float)aniItem.valEnd - scaleTo) / 5); if (zoomAdjust && aniItem.valEnd > aniItem.valStart) { zoomAdjustY = -(scaleTo / (float)zoomAdjustAmount); } containerRotator.transform.localPosition = Vector3.zero.WithY(zoomAdjustY); ; } } }
public void UpdateRotator() { if (containerPlayerDisplay == null) { return; } if (containerPlayerDisplay.transform.childCount == 0) { return; } if (containerRotator == null) { return; } if (rotatorRigidbody == null) { rotatorRigidbody = containerRotator.GetOrSet <Rigidbody>(); } if (rotateObject == null) { rotateObject = containerRotator.GetOrSet <RotateObject>(); } if (rotatorCollider == null) { rotatorCollider = containerRotator.GetOrSet <CapsuleCollider>(); } //rotateObject.enabled = false; if (allowRotator) { if (rotatorRigidbody != null) { rotatorRigidbody.constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionY | RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ; } if (rotateObject != null) { rotateObject.RotateSpeedAlongY = 2; } string keyRotation = "rotation-" + uuid; if (AnimationEasing.EaseExists(keyRotation)) { currentContainerRotation = AnimationEasing.EaseGetValue(keyRotation, 0.0f); currentContainerRotation = (double)Mathf.Clamp((float)currentContainerRotation, (float)rotationMin, (float)rotationMax); //Debug.Log("UpdateScale:" + " currentContainerScale:" + currentContainerScale); float rotateTo = (float)currentContainerRotation; containerRotator.transform.localRotation = Quaternion.Euler(Vector3.zero .WithX(0) .WithY(rotateTo * 360) .WithZ(0)); } } else { containerRotator.ResetObject(); if (rotatorRigidbody != null) { rotatorRigidbody.constraints = RigidbodyConstraints.FreezeAll; } if (rotateObject != null) { rotateObject.RotateSpeedAlongY = 0; } } }