示例#1
0
    private void UpdateRotation()
    {
        if (TargetRotation == null)
        {
            return;
        }

        Quaternion targetRotation = Quaternion.Euler(0, 0, TargetRotation.Value);

        if (RotationSpeed == InstantSpeedValue)
        {
            transform.rotation = targetRotation;
        }
        else
        {
            var deltaTimedRotationSpeed = UiViewHelper.GetDeltaTimedSpeed(RotationSpeed);
            transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, deltaTimedRotationSpeed);
        }
    }
示例#2
0
    private void UpdateScale()
    {
        if (TargetScaling == null)
        {
            return;
        }

        var targetTransformScale = OriginalTransformScale * TargetScaling.Value;

        if (ScalingSpeed == InstantSpeedValue)
        {
            transform.localScale = targetTransformScale;
        }
        else
        {
            var animationSpeed = UiViewHelper.GetDeltaTimedSpeed(ScalingSpeed);
            transform.localScale = Vector3.Lerp(transform.localScale, targetTransformScale, ScalingSpeed);
        }
    }
示例#3
0
    private void UpdatePosition()
    {
        if (TargetPosition == null)
        {
            return;
        }

        float zLock = this.UiViewLayer.GetUiViewLayerZPosition();
        var   zLockedTargetPosition = new Vector3(TargetPosition.x, TargetPosition.y, zLock);

        if (MovementSpeed == InstantSpeedValue)
        {
            transform.position = zLockedTargetPosition;
        }
        else
        {
            var deltaTimedMoveSpeed = UiViewHelper.GetDeltaTimedSpeed(MovementSpeed);
            transform.position = Vector3.MoveTowards(transform.position, zLockedTargetPosition, deltaTimedMoveSpeed);
        }
    }