IEnumerator CreateLineFromMousePos()
    {
        while (true)
        {
            if (Input.GetMouseButtonDown(1))
            {
                if (line != null)
                {
                    GameObject.Destroy(line);
                }

                GameStateManager.Instance.SetInactiveState();
                GameStateManager.Instance.SetDragComponentsState();
                yield break;
            }

            LineGeneratorHelper.EndPositionVariables vars = new LineGeneratorHelper.EndPositionVariables(
                line, startPosition, Camera.main.ScreenToWorldPoint(Input.mousePosition), originalScale, originalWidth, oldZAngle);
            (line, oldZAngle) = LineGeneratorHelper.SetEndPositionAndGetAngle(vars);

            //SetEndPosition(Camera.main.ScreenToWorldPoint(Input.mousePosition));

            yield return(null);
        }
    }
    public void UpdateLinePosition(GameObject existingLine, Vector3 startNodePos, Vector3 endNodePos)
    {
        existingLine.transform.rotation = pipePrefab.transform.rotation;
        existingLine.transform.position = startNodePos;

        LineGeneratorHelper.EndPositionVariables vars = new LineGeneratorHelper.EndPositionVariables(
            existingLine, startNodePos, endNodePos, pipePrefab.transform.localScale, pipePrefab.GetComponent <SpriteRenderer>().bounds.size.x / 2, 0.0f);
        existingLine = LineGeneratorHelper.SetEndPosition(vars);

        //existingLine = SetEndPosition(endNodePos);
    }
    private void CreateNodeEnd(Vector3 endPos, bool runCoroutine = true)
    {
        hasCreatedStart = false;
        endPosition     = endPos;

        if (runCoroutine)
        {
            StopCoroutine("CreateLineFromMousePos");
        }
        GameStateManager.Instance.SetInactiveState();
        GameStateManager.Instance.SetDragComponentsState();

        LineGeneratorHelper.EndPositionVariables vars = new LineGeneratorHelper.EndPositionVariables(
            line, startPosition, endPosition, originalScale, originalWidth, oldZAngle);
        line = LineGeneratorHelper.SetEndPosition(vars);

        if (TutorialManager.Instance != null)
        {
            TutorialManager.Instance.CheckEvent(localEventID);
        }

        //SetEndPosition(endPos);
        CreateSymbol();
    }