protected void Update() { if (Velocity <= 0 || (Dh == 0 && Dv == 0)) { return; } // Debug.Log("MO.Update" + Dh); var dx = MoveX ? Dh * Velocity * Time.deltaTime : 0; var dy = MoveY ? Dv * Velocity * Time.deltaTime : 0; var moved = false; if (Force) { moved = true; if (MoveX) { _mvnt.ForceMoveAlongX(dx); } if (MoveY) { _mvnt.ForceMoveAlongY(dy); } } else { if (MoveX) { moved = _mvnt.MoveAlongX(dx) || moved; } if (MoveY) { moved = _mvnt.MoveAlongY(dy) || moved; } } var distance = Mathf.Sqrt(dx * dx + dy * dy); RemainingDistance -= distance; if (RemainingDistance <= 0) { StopMoving(); } OnMove(distance, moved); if (Input.GetKeyDown(KeyCode.Space)) { // Mvnt.SmoothGridMove(Vector2.right, Distance, false); } }