예제 #1
0
    private void MoveToMouse()
    {
        Ray   ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        float distance;

        if (_groundManager.GroundPlane.Raycast(ray, out distance))
        {
            Vector3 rayPoint            = ray.GetPoint(distance);
            Vector3 closestTilePosition = _groundManager.GetClosestTilePosition(rayPoint);

            transform.position = new Vector3(closestTilePosition.x, transform.position.y, closestTilePosition.z);
        }
    }