protected override void MoveCharacter() { if (_usingPath) { if (_gdi != null && !_isMoving) { StopCoroutine(_gdi); _element = 0; } if (Vector3.Distance(transform.position, _path.ElementAt(_element)) < float.Epsilon) { _element++; } if (_element < _path.Count()) { MoveAcrossPath(_path.ElementAt(_element)); } } else { if (canAttack && _target && !_attackCooldown) { if (Vector3.Distance(_rb.position, _target.transform.position) < attackDistance) { StateChange.ToAttackState(); } } if (_attackCooldown && _rb.isKinematic == false) { if (_timer <= _attackCooldownTime - 2) { _rb.isKinematic = true; } } if (_rb.isKinematic) { Vector3 direction = _goalPosition - _rb.position; _rb.MovePosition(_rb.position + direction * movementSpeed * Time.deltaTime); //transform.Rotate(direction, Space.Self); } if (!(Vector3.Distance(_rb.position, _goalPosition) < 1)) { return; } StateChange.ToFindTargetState(); } }