Example #1
0
    private void Track()
    {
        if (!pressed)
        {
            return;
        }

        if (Input.GetMouseButtonDown(1))
        {
            pressed = false;
            Repaint();
            return;
        }

        if (!Input.GetMouseButtonDown(0))
        {
            return;
        }

        var hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);

        if (hit.collider == null)
        {
            return;
        }

        ElementFactory.Attach(hit.collider.gameObject, currentAttachment);
    }