void FindVisibleTargets()
    {
        targetsInView.Clear();
        Collider2D[]             targetsInViewRadius = Physics2D.OverlapCircleAll((new Vector2(transform.position.x, transform.position.y)), viewRadius, playerMask);
        ComputerControllerSeated npc = GetComponent <ComputerControllerSeated> ();

        for (int i = 0; i < targetsInViewRadius.Length; i++)
        {
            Transform target            = targetsInViewRadius [i].transform;
            Vector3   directionToTarget = (target.position - transform.position);
            if (Vector2.Angle(npc.getDirection2D(), directionToTarget) < viewAngle / 2)
            {
                RaycastHit2D hit = Physics2D.Raycast(transform.position, npc.getDirection2D());
                if (hit.collider != null)
                {
                    targetsInView.Add(target);
                    if (target.gameObject.CompareTag("useable") && target.gameObject.GetComponent <SpriteRenderer> ().enabled == true)
                    {
                        StartCoroutine("UseableDelay", 10f);
                    }
                    else if (target.gameObject.CompareTag("useable") && target.gameObject.GetComponent <SpriteRenderer> ().enabled == false)
                    {
                        ;
                    }
                    else
                    {
                        //ifDetected.text = "DETECTED! Restarting...";
                        isDetected = true;
                        PlayerData.Instance.coins = 0;
                        LoseScreen.SetActive(true);
                    }
                }
            }
        }
    }
    IEnumerator UseableDelay(float delay)
    {
        ComputerControllerSeated npc = GetComponent <ComputerControllerSeated> ();

        npc.angle  = 0;
        npc.radius = 0;
        npc.paused = true;
        yield return(new WaitForSeconds(delay));

        npc.paused = false;
    }
 public Vector3 dFromAngle(float angle, bool isGlobal)
 {
     if (!isGlobal)
     {
         ComputerControllerSeated C = GetComponent <ComputerControllerSeated> ();
         if (C.getDirection() == Vector3.right)
         {
             angle += 90;
         }
         else if (C.getDirection() == Vector3.left)
         {
             angle += -90;
         }
         else if (C.getDirection() == Vector3.down)
         {
             angle += 180;
         }
     }
     return(new Vector3(Mathf.Sin(angle * Mathf.Deg2Rad), Mathf.Cos(angle * Mathf.Deg2Rad), -1));
 }