private void Update()
        {
            float step = speed * Time.deltaTime;

            Vector3 nextPosition = visionCone.FollowThePlayer() ? player.position : positions[vectorPosition].transform.position;

            transform.position = Vector2.MoveTowards(transform.position, nextPosition, speed * Time.deltaTime);
            if (transform.position == nextPosition)
            {
                vectorPosition = vectorPosition == positions.Length - 1 ? 0 : vectorPosition + 1;
            }

            var heading   = transform.position - nextPosition;
            var distance  = heading.magnitude;
            var direction = heading / distance;

            if (GameObject.FindWithTag("pushable") != null)
            {
                //print("andando");
                animation(direction);
            }


            visionCone.SetAimDirection(direction * -1);
            visionCone.SetOrigin(transform.position);
        }
 protected virtual void UpdateVisionCone()
 {
     // Actualiza los valores del Cono de vision para que este se dibuje correctamente
     visionConeScript.SetOrigin(transform.position);
     if (rb.velocity != Vector2.zero)
     {
         visionConeScript.SetDirection(rb.velocity);
     }
 }
    // Update is called once per frame
    void Update()
    {
        visionConeScript.SetOrigin(transform.position);
        visionConeScript.SetDirection(AngleToVector(transform.localRotation.eulerAngles.z));
        if (player != null)
        {
            CheckPlayer();
        }

        if (detected)
        {
            soundCD -= Time.deltaTime;
            if (soundCD <= 0)
            {
                detected = false;
            }
        }
    }