private void ATTACK(Vector3f direction, float distance)
    {

        double time = (double)Time.getTime()/(double)(Time.SECOND);
        double timeDecimals = time - (double)((int)time);

        if(timeDecimals < 0.25)
        {
            material.setTexture(textures.get(4));
        }
        else if(timeDecimals < 0.5)
            material.setTexture(textures.get(5));
        else if(timeDecimals < 0.75)
        {
            material.setTexture(textures.get(6));
        if(canShoot){
            Vector2f lineStart = new Vector2f(transform.getTranslation().getX(), transform.getTranslation().getZ());
            Vector2f castDirection = new Vector2f(direction.getX(),direction.getZ()).rotate((random.nextFloat() - 0.5f) * SHOT_ANGLE);
            Vector2f lineEnd = lineStart.add(castDirection.mul(1000.0f));

            Vector2f colVector = Game.getLevel().checkIntersection(lineStart, lineEnd, false);

            Vector2f playerIntersectVector = Game.getLevel().lineInterSectRect(lineStart,lineEnd, new Vector2f(Transform.getCamera().getPos().getX(), Transform.getCamera().getPos().getZ()), new Vector2f(Player.PLAYER_SIZE, Player.PLAYER_SIZE));

            if(playerIntersectVector != null &&  (colVector == null ||
            playerIntersectVector.sub(lineStart).length() < colVector.sub(lineStart).length()))
            {
                Game.getLevel().getPlayer().damage(random.nextInt(DAMAGE_MAX - DAMAGE_MIN) + DAMAGE_MIN);
            }
            state = STATE_CHASE;
                canShoot = false;

    }}else
    {
        material.setTexture(textures.get(5));
        canShoot = true;
    }

    }