// Update is called once per frame
    void Update()
    {
        switch (myState)
        {
        case AIState.Guarding:

            Guarding();
            break;

        case AIState.Chasing:
            Chasing();
            break;

        case AIState.Inspecting:
            Inspecting();
            break;
        }


        //makes sure enemies stay on the ground (no floating off elevated parts)
        Velocity += Vector3.down * 5;

        //enemy stops chasing and begins guarding if it is close to it's target
        //right now, enemy and player collide at about .9 away so checking any further will make the enemy leave before killing the player
        //if (myState != AIState.Guarding && Vector3.Distance(transform.position, target.position) < .35)
        {
            //myState = AIState.Guarding;
            //SetClosestPath();
        }
        //else
        {
            myAnimatorScript.UpdateAnimator(Velocity.x, Velocity.z);
            myCC.Move(Velocity * Time.deltaTime);
            Velocity *= 0;
        }
    }
    void processInput()
    {
        float usedSpeed = speed;

        if (Input.GetKey(KeyCode.LeftShift))
        {
            usedSpeed = sprintSpeed;
        }
        if (Input.GetKey(KeyCode.W))
        {
            if (usedSpeed == sprintSpeed)
            {
                noiseLevel = 2;
            }
            else
            {
                noiseLevel = 1;
            }
            Velocity += (Vector3.forward * Time.deltaTime * usedSpeed);
        }
        if (Input.GetKey(KeyCode.A))
        {
            if (usedSpeed == sprintSpeed)
            {
                noiseLevel = 2;
            }
            else
            {
                noiseLevel = 1;
            }
            Velocity += (Vector3.left * Time.deltaTime * usedSpeed);
        }
        if (Input.GetKey(KeyCode.S))
        {
            if (usedSpeed == sprintSpeed)
            {
                noiseLevel = 2;
            }
            else
            {
                noiseLevel = 1;
            }
            Velocity += (Vector3.back * Time.deltaTime * usedSpeed);
        }
        if (Input.GetKey(KeyCode.D))
        {
            if (usedSpeed == sprintSpeed)
            {
                noiseLevel = 2;
            }
            else
            {
                noiseLevel = 1;
            }
            Velocity += (Vector3.right * Time.deltaTime * usedSpeed);
        }

        //a brightness adjuster, for unnecessarily dark computers
        if (Input.GetKey(KeyCode.R) && brightnessAdjuster)
        {
            brightnessAdjuster.intensity += .01f;
        }
        if (Input.GetKey(KeyCode.F) && brightnessAdjuster)
        {
            brightnessAdjuster.intensity -= .01f;
        }
        if (Input.GetKey(KeyCode.Escape))
        {
            GameManager.Restart();
        }


        if (myAnimatorScript)
        {
            // Send this data to the animator script
            Vector3 temp = Velocity / Time.deltaTime;
            myAnimatorScript.UpdateAnimator(temp.x, temp.z, Velocity.magnitude / (3 / usedSpeed));
        }

        Velocity += Vector3.down;
        myCC.Move(Velocity);
        Velocity *= .8f;
    }