IEnumerator Attack()
    {
        anim.SetBool("isFiring", true);
        anim.SetTrigger("setFiring");
        Debug.Log("Firing laser!", this);

        BeamTargeting.SetActive(true);
        yield return(new WaitForSeconds(2.5f));

        BeamTargeting.SetActive(false);
        BeamFiring.SetActive(true);
        RaycastHit2D hit = Physics2D.Raycast(BeamOrigin.transform.position, Vector2.right, 30, entLayerMask);

        if (hit.collider != null)
        {
            OnHitObject(hit);
        }
        else
        {
            Debug.Log("Did not hit", this);
        }
        yield return(new WaitForSeconds(1f));

        BeamFiring.SetActive(false);
        anim.GetBehaviour <RangedAim>().timerFire = false;
        anim.SetBool("isFiring", false);
        anim.SetBool("isAiming", false);
    }
    /*
     * // Update is called once per frame
     * void Update()
     * {
     *
     * }
     *
     * void FixedUpdate()
     * {
     *
     * }
     */
    #region Control Functions

    public void Target()
    {
        if (!anim.GetBool("isFiring"))
        {
            //anim.SetBool("isFiring", true);
            //anim.SetTrigger("setFiring");
            Debug.Log("Targeting laser!", this);

            BeamTargeting.SetActive(true);
            //StartCoroutine(Attack());
            //anim.SetTrigger("setFiring");
            //anim.SetBool("isFiring", true);
            Invoke("Fire", 2f);
        }
    }
    public void Fire()
    {
        Debug.Log("Firing laser!", this);
        BeamTargeting.SetActive(false);
        BeamFiring.SetActive(true);
        sound.Play();
        RaycastHit2D hit = Physics2D.Raycast(BeamOrigin.transform.position, Vector2.right, 30, entLayerMask);

        if (hit.collider != null)
        {
            OnHitObject(hit);
        }
        else
        {
            Debug.Log("Did not hit", this);
        }
        Invoke("ExitFiringState", 1f);
    }