protected override async ValueTask UpdateCore(GameContext game) { if (_path is null || (!_path.Any() && _currPathNode is null)) { return; } _currPathNode ??= _path.Next(); var tilePos = _mapRenderer.GetTilePos(_currPathNode); var newPos = Vector2Utils.MoveTowards(_transform.World.Position, tilePos, Speed); _transform.Local.Position = newPos; var dist = Vector2.DistanceSquared(newPos, tilePos); if (dist < Speed) { _currPathNode = null; _transform.Local.Position = tilePos; if (!_path.Any()) { _path = null; OnArrived?.Invoke(this); } } }