// Update is called once per frame
    void Update()
    {
        float   joystickX   = controls.getRightStickX();
        float   joystickY   = controls.getRightStickY();
        Vector3 joystickVec = new Vector3(joystickX, joystickY, 0);

        if (controls.getRightTriggerDown())
        {
            if (joystickVec != Vector3.zero)
            {
                GameObject pellet = Instantiate(pelletObj, transform.position, Quaternion.identity);
                pellet.GetComponent <Pellet>().SetOwner(transform.parent.GetComponent <PlayerController>().GetPlayerNumber());
                pellet.GetComponent <Rigidbody2D>().AddForce(joystickVec * pelletSpeed);
            }
            //SHOOT
        }
        cursorPos = joystickVec;
        cursorPos.Normalize();
        cursorPos = cursorPos * radius;
        if (joystickVec != Vector3.zero)
        {
            transform.localPosition = cursorPos;
            transform.up            = joystickVec;
        }
    }
    IEnumerator displayTutorialButtons()
    {
        yield return(new WaitForSeconds(2));

        StartCoroutine(FadeOut(fader));
        yield return(new WaitForSeconds(3));

        //Spawn in Trigger button prompt
        StartCoroutine(FadeIn(triggerPrompt));
        yield return(new WaitUntil(() => controls.getRightTriggerDown()));

        //Change color of trigger button prompt
        yield return(new WaitForSeconds(4));

        //Spawn in Analog stick prompt
        yield return(new WaitForSeconds(1));

        StartCoroutine(FadeIn(analogPrompt));
        yield return(new WaitUntil(() => controls.getRightTrigger() && (controls.getLeftStickX() > Mathf.Abs(0.5f) || controls.getLeftStickY() > Mathf.Abs(0.5f))));

        //Change color of analog stick prompt
        yield return(new WaitForSeconds(10));

        StartCoroutine(FadeOut(triggerPrompt));
        StartCoroutine(FadeOut(analogPrompt));
        yield return(new WaitForSeconds(1));

        StartCoroutine(FadeIn(neuronPrompt));
        yield return(new WaitForSeconds(3));

        neuron.SetActive(true);
        //Spawn in start button
        yield return(new WaitUntil(() => neuron.GetComponent <Neuron>().activated));

        StartCoroutine(FadeOut(neuronPrompt));
        yield return(new WaitForSeconds(3));

        StartCoroutine(FadeIn(startPrompt));
        yield return(new WaitUntil(() => controls.getADown()));

        StartCoroutine(FadeIn(fader));
        yield return(new WaitForSeconds(2));

        SceneManager.LoadScene(2);



        yield return(null);
    }
    // Update is called once per frame
    void Update()
    {
        bool stunned = transform.parent.GetComponent <PlayerController>().stunned;

        if (stunned || paused)
        {
            AkSoundEngine.PostEvent("Set_State_Surfing_Off", gameObject);
        }
        if (!paused && !stunned)
        {
            //if (controls.getADown()) {
            //    transform.parent.gameObject.GetComponent<PlayerController>().destroyEntireTrail();
            //    Camera.main.GetComponent<Shake>().shakeDuration = 0.5f;

            //}

            if (softLine != null)
            {
                softLine.UpdateLine(transform.position);
                List <Vector2> points = softLine.GetPoints();
                if (points.Count > 0)
                {
                    for (int i = 0; i < points.Count - 10; i++)
                    {
                        if (Vector2.Distance(points[points.Count - 1], points[i]) < 0.5f && !circleDrawn)
                        {
                            circleDrawn = true;
                            softLine.GetComponent <SoftLine>().NeuronCircled(transform.position, transform.up);
                            Debug.Log("Circle Drawn!");
                            circleDrawn = false;
                        }
                    }
                }
            }

            if (controls.getRightTriggerDown()) //generating a few false positives at first
            {
                //Debug.Log("Drawing??");
                player.destroyEntireTrail();
                GameObject line = Instantiate(linePrefab);
                activeLine = line.GetComponent <Line>();
                AkSoundEngine.PostEvent("Set_State_Surfing_On", gameObject);

                LightOn();
            }
            if (controls.getRightTriggerUp())
            {
                activeLine = null;
                AkSoundEngine.PostEvent("Set_State_Surfing_Off", gameObject);

                LightOff();
            }
            if (activeLine != null)
            {
                activeLine.UpdateLine(transform.position);
            }
            float joystickX = controls.getLeftStickX();
            float joystickY = controls.getLeftStickY();
            if (joystickX == 0)
            {
                joystickX = -1;
            }
            Vector3 joystickVec = new Vector3(joystickX, joystickY, 0);
            Vector3 ballVec     = transform.position - transform.parent.position;
            angle = Vector2.Angle(joystickVec, ballVec);
            if (angle >= 30)
            {
                lerpFract = 0.2f;
            }
            else
            {
                lerpFract = 0.4f;
            }
            cursorPos = Vector3.Lerp(transform.position - transform.parent.position, joystickVec, lerpFract);
            cursorPos.Normalize();
            cursorPos = cursorPos * radius;
            transform.localPosition = cursorPos;
        }
    }