override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { playerPos = GameObject.FindGameObjectWithTag("Player").transform; rb = animator.GetComponent <Rigidbody2D>(); moveSpeed = animator.GetComponent <Elemental_behaviour>().speed; eb = animator.GetComponent <Elemental_behaviour>(); }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { rnd = new System.Random(); eb = animator.GetComponent <Elemental_behaviour>(); move = rnd.Next(0, 10); if (eb.distance <= 6) { if (move < 5) { animator.SetTrigger("AttackHeavy"); } else { animator.SetTrigger("AttackPike"); } } else { if (move < 5) { animator.SetTrigger("AttackShot"); } else if (move < 7) { animator.SetTrigger("AttackPike"); } else { animator.SetTrigger("AttackHeavy"); } } //if (move < 3) //{ // animator.SetTrigger("AttackHeavy"); //} //else if(move < 5) //{ // animator.SetTrigger("AttackPike"); //} //else //{ // animator.SetTrigger("AttackShot"); //} }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { eb = animator.GetComponent <Elemental_behaviour>(); }