コード例 #1
0
        public void Resize(Transform transform, JellyInput input, float timeDelta)
        {
            if (input.frameSwipeDelta > 0.0f && transform.localScale.y < this.maxScale)
            {
                this.ResizeHelper(transform, input, Time.deltaTime);
            }

            else if (input.frameSwipeDelta < 0.0f && transform.localScale.y > this.minScale)
            {
                this.ResizeHelper(transform, input, Time.deltaTime);
            }
        }
コード例 #2
0
        private void ResizeHelper(Transform transform, JellyInput input, float deltaTime)
        {
            var curScale = transform.localScale;
            var newScale = curScale;

            var scaledFrameDelta = input.frameSwipeDelta * deltaTime;

            newScale.x -= scaledFrameDelta;
            newScale.y += scaledFrameDelta;

            if (newScale.y > maxScale || newScale.y < this.minScale)
            {
                return;
            }

            var newPosition = transform.localPosition;

            newPosition.y += scaledFrameDelta / 2.0f;

            transform.localScale    = newScale;
            transform.localPosition = newPosition;
        }