// Update is called once per frame void Update() { if (seekTimer.IsReady && target == null) { if ((Player.Instance.transform.position - this.transform.position).magnitude < seekRadius) { target = Player.Instance.transform; seeker = behaviour.GetBehaviour(target); } else { var i = Wander(); seeker = () => i; } } //fireArrows if (target != null && fireArrows && arrowCooldown.IsReady) { StartCoroutine("ChannelProjectile"); } //Anim updates if (anim != null) { if (rb.velocity.sqrMagnitude > .05f) { anim.SetBool("isMoving", true); } else { anim.SetBool("isMoving", false); } if (target != null && !fireArrows) { Vector2 dist = target.position - transform.position; float absDist = dist.magnitude; if (absDist < 1.8f) { anim.SetTrigger("Attack"); } anim.SetFloat("xInput", dist.normalized.x); anim.SetFloat("yInput", dist.normalized.y); } else if (target != null && fireArrows) { Vector2 dir = target.position - transform.position; dir = dir.normalized; anim.SetFloat("xAim", dir.x); anim.SetFloat("yAim", dir.y); } else { anim.SetFloat("xInput", rb.velocity.normalized.x); anim.SetFloat("yInput", rb.velocity.normalized.y); } } }