public void MoveTo(int x, int y) { lock (_runningLock) { if (!_running) { var animator = new Animator2D(FPSLimiterKnownValues.LimitSixty); var currPos = _playerDrawable.GetPosition(); animator.Paths = CreatePath(currPos.X, currPos.Y, x, y); _lastPathEnd = animator.Paths.Last().End; animator.Play(_frameCallbackInvoker, _endCallback); _running = true; } else { var path = CreatePath((int)_lastPathEnd.X, (int)_lastPathEnd.Y, x, y); _lastPathEnd = path.Last().End; foreach (var path2D in path) { _waitingPaths.Add(path2D); } } } }
public Path2D(Float2D start, Float2D end, ulong duration) : this(new Path(start.X, end.X, duration), new Path(start.Y, end.Y, duration)) { }
public Path2D(Float2D start, Float2D end, ulong duration, AnimationFunctions.Function function) : this(new Path(start.X, end.X, duration, function), new Path(start.Y, end.Y, duration, function)) { }
private void FrameCallback(Float2D float2D) { _playerDrawable.SetPosition(float2D); }