void Update() { var deltaX = mouse.DeltaX; if (deltaX > 0 || deltaX < 0) { var lastPosition = data.GetPosition(); data.SetPositionX(lastPosition.x + deltaX); data.SetSpeed(new Vector2(deltaX / Time.deltaTime, 0)); UpdatePosition(); } else { data.SetSpeed(Vector2.zero); } }