// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
if(animator.gameObject.GetComponent<Enemy>().indexPos == 0){
if(animator.GetInteger("attack") == 1){
GameObject EarthBend = (GameObject)Instantiate(Resources.Load("EarthBend", typeof(GameObject)), GameObject.Find("skillSpawn(1)").transform.position, GameObject.Find("skillSpawn(1)").transform.rotation);
EarthBend.GetComponent<Rigidbody>().velocity = EarthBend.transform.TransformDirection(Vector3.forward * 15);
EarthBend.transform.FindChild("source").gameObject.tag = "Enemy1Attack";
}
}
if(animator.gameObject.GetComponent<Enemy>().indexPos == 1){
if(animator.GetInteger("attack") == 1){
GameObject EarthBend = (GameObject)Instantiate(Resources.Load("EarthBend", typeof(GameObject)), GameObject.Find("skillSpawn(2)").transform.position, GameObject.Find("skillSpawn(2)").transform.rotation);
EarthBend.GetComponent<Rigidbody>().velocity = EarthBend.transform.TransformDirection(Vector3.forward * 15);
EarthBend.transform.FindChild("source").gameObject.tag = "Enemy2Attack";
}
}
if(animator.gameObject.GetComponent<Enemy>().indexPos == 2){
if(animator.GetInteger("attack") == 1){
GameObject EarthBend = (GameObject)Instantiate(Resources.Load("EarthBend", typeof(GameObject)), GameObject.Find("skillSpawn(3)").transform.position, GameObject.Find("skillSpawn(3)").transform.rotation);
EarthBend.GetComponent<Rigidbody>().velocity = EarthBend.transform.TransformDirection(Vector3.forward * 15);
EarthBend.transform.FindChild("source").gameObject.tag = "Enemy3Attack";
}
}
}