Beispiel #1
0
        private Vector3 SnapToSprites(Vector3 position)
        {
            SpriteRenderer component = anchorJoint2D.GetComponent <SpriteRenderer>();

            position = SnapToSprite(component, position, 0.13f);

            if (anchorJoint2D.connectedBody)
            {
                component = anchorJoint2D.connectedBody.GetComponent <SpriteRenderer>();
                position  = SnapToSprite(component, position, 0.13f);
            }

            return(position);
        }
Beispiel #2
0
        Vector3 SnapToSprites(Vector3 position)
        {
            SpriteRenderer spriteRenderer = anchorJoint2D.GetComponent <SpriteRenderer>();

            position = SnapToSprite(spriteRenderer, position, k_SnapDistance);

            if (anchorJoint2D.connectedBody)
            {
                spriteRenderer = anchorJoint2D.connectedBody.GetComponent <SpriteRenderer>();
                position       = SnapToSprite(spriteRenderer, position, k_SnapDistance);
            }

            return(position);
        }