public void EnemyAttack()
    {
        FaceTarget(player.transform);

        agent.SetDestination(this.transform.position);



        if (timeBetweenShots <= 0 && curDistance <= radius)
        {
            enemyShooting.ShootGun();
            timeBetweenShots = origTBS;
        }
        else
        {
            timeBetweenShots   -= Time.deltaTime;
            eyes.material.color = Color.Lerp(Color.red, Color.yellow, timeBetweenShots);
            //GetComponent<Renderer>().material.color = Color.Lerp(Color.red, Color.yellow, timeBetweenShots);
        }


        if (curDistance > radius)
        {
            curState = EnemyState.Chase;
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (enemyHealth.isDead)
        {
            return;
        }

        curDistance = Vector3.Distance(transform.position, player.transform.position);

        FaceTarget(player.transform);

        if (curDistance > stopDistance)
        {
            agent.SetDestination(player.transform.position);
            agent.speed = origAgentSpeed;
            Debug.Log("Enemy is chasing the player");
        }
        else if (curDistance < stopDistance && curDistance > retreatDistance)
        {
            //agent.SetDestination(this.transform.position);
            agent.speed = 0f;
            Debug.Log("Enemy is staying still");
        }
        else if (curDistance < retreatDistance)
        {
            agent.SetDestination(player.transform.position);
            agent.speed = -5 * origAgentSpeed;
            Debug.Log("Enemy is retreating");
        }



        if (timeBetweenShots <= 0 && curDistance < stopDistance)
        {
            //Instantiate(projectile, firePoint.transform.position, transform.rotation);
            enemyShoots.ShootGun();
            timeBetweenShots = origTBS;
        }
        else
        {
            timeBetweenShots        -= Time.deltaTime;
            enemyEyes.material.color = Color.Lerp(Color.red, Color.yellow, timeBetweenShots);
        }
    }
    public void ShootEnemy()
    {
        Debug.Log("Enemy is shooting");

        if (timeBetweenShots <= 0 && curDistance <= radius)
        {
            //Instantiate(projectile, firePoint.transform.position, transform.rotation);
            enemyShooting.ShootGun();
            timeBetweenShots = origTBS;
        }
        else
        {
            timeBetweenShots   -= Time.deltaTime;
            body.material.color = Color.Lerp(Color.red, Color.yellow, timeBetweenShots);
        }

        if (curDistance > radius)
        {
            curEnemyState = EnemyState.Move;
        }
    }