// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { rnd = new System.Random(); nb = animator.GetComponent <NecrBehaviour>(); move = rnd.Next(0, 10); if (animator.GetComponent <Boss>().healthLeft < (animator.GetComponent <Boss>().health / 2) && acid) { animator.SetTrigger("Sneer"); acid = false; } else if (nb.distance <= punchDistance) { animator.SetTrigger("AttackHit"); } else if (nb.scelCount < 2 && move < 3) { animator.SetTrigger("AttackScel"); nb.scelCount++; } else if (nb.zombCount < 1 && move < 5) { animator.SetTrigger("AttackZomb"); nb.zombCount++; } else { animator.SetTrigger("AttackShot"); } //if (animator.GetComponent<Boss>().healthLeft < animator.GetComponent<Boss>().health) //{ //} //else }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { playerPos = GameObject.FindGameObjectWithTag("Player").transform; rb = animator.GetComponent <Rigidbody2D>(); moveSpeed = animator.GetComponent <NecrBehaviour>().speed; nb = animator.GetComponent <NecrBehaviour>(); }
public void Start() { healthLeft = health; rb = gameObject.GetComponent <Rigidbody2D>(); lootManager = GameObject.Find("GameManager"); nb = GameObject.Find("Necrophos").GetComponent <NecrBehaviour>(); NecrAnim = nb.GetComponent <Animator>(); player = GameObject.FindGameObjectWithTag("Player"); playerPos = player.transform; basic = gameObject.GetComponent <Enemy_behaviour>().speed; animSpeed = gameObject.GetComponent <Animator>().speed; }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { nb = animator.GetComponent <NecrBehaviour>(); }