private void CalculatePath() { // if level grid exists and actor can move, otherwise ignore if (_pathField != null && _protagonist.movementSpeed > 0) { _pathField.GetPath(_protagonistTransform.position, GetFinalTargetPosition(), _path); if (_path.isValid) { _hasPath = true; } } }
private void CalculatePath() { // if level grid exists and actor can move, otherwise ignore if (_pathField != null && _protagonist.movementSpeed > 0) { _pathField.GetPath(_protagonistTransform.position, GetFinalTargetPosition(), _path); _hasPath = _path.isValid; if (!_hasPath) { if (type == TargetType.Position) { ReachTarget(); } } } }