public override void ConfigureControl()
        {
            var worldOffset = (Vector3)offset * TouchManager.UnitToWorld;

            transform.position = TouchManager.ViewToWorldPoint(TouchUtility.AnchorToViewPoint(anchor)) + worldOffset;

            ScaleSprite(buttonGameObject, buttonRenderer, buttonSize);

            worldButtonSize = buttonSize * TouchManager.HalfUnitToWorld;
        }
示例#2
0
        protected Vector3 OffsetToWorldPosition(TouchControlAnchor anchor, Vector2 offset, TouchUnitType offsetUnitType)
        {
            Vector3 worldOffset;

            if (offsetUnitType == TouchUnitType.Pixels)
            {
                worldOffset = TouchUtility.RoundVector(offset) * TouchManager.PixelToWorld;
            }
            else
            {
                worldOffset = (Vector3)offset * TouchManager.PercentToWorld;
            }
            return(TouchManager.ViewToWorldPoint(TouchUtility.AnchorToViewPoint(anchor)) + worldOffset);
        }
        public override void ConfigureControl()
        {
            var worldOffset = (Vector3)offset * TouchManager.UnitToWorld;

            resetPosition      = TouchManager.ViewToWorldPoint(TouchUtility.AnchorToViewPoint(anchor)) + worldOffset;
            transform.position = resetPosition;

            ScaleSprite(ringGameObject, ringRenderer, ringSize);
            ScaleSprite(knobGameObject, knobRenderer, knobSize);

            worldActiveArea = TouchManager.ViewToWorldRect(activeArea);
            worldRingSize   = ringSize * TouchManager.HalfUnitToWorld;
            worldKnobSize   = knobSize * TouchManager.HalfUnitToWorld;
            worldKnobRange  = knobRange * TouchManager.HalfUnitToWorld;
        }
示例#4
0
        protected Vector3 OffsetToWorldPosition(TouchControlAnchor anchor, Vector2 offset, TouchUnitType offsetUnitType, bool lockAspectRatio)
        {
            Vector3 b = (offsetUnitType == TouchUnitType.Pixels) ? ((Vector3)(TouchUtility.RoundVector(offset) * TouchManager.PixelToWorld)) : ((!lockAspectRatio) ? Vector3.Scale(offset, TouchManager.ViewSize) : ((Vector3)offset * TouchManager.PercentToWorld));

            return(TouchManager.ViewToWorldPoint(TouchUtility.AnchorToViewPoint(anchor)) + b);
        }