private void MoveToPosition(Vector3 position, string colliderTag) { Quaternion rotation = Quaternion.LookRotation(position - transform.position); rotation.x = 0f; rotation.z = 0f; transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * 10); if (Vector3.Distance(transform.position, position) >= Melee.weaponRange) { controller.SimpleMove(transform.forward * Speed); animation.CrossFade(run.name); } else if (Vector3.Distance(transform.position, position) < Melee.weaponRange && colliderTag != "Player") { //Debug.Log("hi there"); animation.Play("attack"); Melee.AttackEnemy(position, hit); } }