private void MoveTo(float x, float y) { float speed = GetSpeed(); if (position.DistanceTo(x, y) > speed) { double angle = Math.Atan2(y - position.Y, x - position.X); position.X += (float)(speed * Math.Cos(angle)); position.Y += (float)(speed * Math.Sin(angle)); } else { position.X = x; position.Y = y; _moveQueue.Dequeue().OnReach?.Invoke(x, y); } }