コード例 #1
0
    void Update()
    {
        if (mIsDragging)
        {
            Vector2 position = mFixedCornerButton.GetManager().ScreenToGui(new Vector2(Input.mousePosition.x, Input.mousePosition.y));

            float fixedCornerX = mFixedCornerButton.GetAbsolutePosition().x;
            float fixedCornerY = mFixedCornerButton.GetAbsolutePosition().y;

            float width  = Mathf.Abs(position.x - fixedCornerX);
            float height = Mathf.Abs(position.y - fixedCornerY);

            mSprite.Size = new Vector2(width, height);

            if (!Input.GetMouseButton(0))
            {
                StopDragging();
            }
        }
    }