If (anim.Animator.GetCurrentAnimatorStateInfo....SHOOT PLAYER??? HELP!

I have an Enemy with Animator Animations that are working. I’m using RAIN AI for the AI and need to use my own script for this part because I am not familiar with doing this with RAIN. Basicaly what I need to do, is when my enemy gets to the “idle_aiming” animation, I need it to start shooting at me. I have this script that is a tweaked version of the player shooting script for my player to shoot the enemy. Well, everything works but I thought I could put this on my bullet spawn on the gun for the enemy but it doesn’t work because the animator controller is the enemy. And when i put this on the enemy, some very strange things happen because the bullet spawn is coming from??? Not sure where. Please help.

Here is the script

using UnityEngine;
using System.Collections;

public class EnemyShootPlayer : MonoBehaviour
{
    public Animator anim;
    public float bulletSpeed = 10;
    public Rigidbody bullet;


    void Start ()
        {
        anim = GetComponent<Animator>();          
        }

    void ShootPlayer()
    {
        Rigidbody bulletClone = (Rigidbody) Instantiate(bullet, transform.position, transform.rotation);
        bulletClone.velocity = transform.forward * bulletSpeed;
    }

    void FixedUpdate ()
    {   

        if (anim.GetCurrentAnimatorStateInfo(0).IsName("idle_aiming"))
            ShootPlayer();
    }


   

}

I figured it out on my own. In case anyone else is having issues. This script works!!! You put it on the BulletSpawn attached to the Enemy Gun. Just set your vars

using System.Collections;

public class EnemyShootPlayer : MonoBehaviour
{
    public Animator anim; //// Attached your Enemy here
    public float bulletSpeed = 10; /// speed of bullets, set to around 300 for good results
    public Rigidbody bullet; /// your bullet prefab
    public GameObject otherGameObject; /// attach your enemy here also.


    void Start ()
        {
        
        anim = otherGameObject.GetComponent<Animator>();
    }

    void ShootPlayer()
    {
        Rigidbody bulletClone = (Rigidbody) Instantiate(bullet, transform.position, transform.rotation);
        bulletClone.velocity = transform.forward * bulletSpeed;
    }

    void FixedUpdate ()
    {   

        if (anim.GetCurrentAnimatorStateInfo(0).IsName("idle_aiming"))
            ShootPlayer();
    }


   

}