Unity 3D player movement boundary (Sphere object)

I want to restrict player movement in the sphere ranges, the schematic diagram show as below, the maximum movement distance is sphere radius. if player movement out of ranges, then restrict player position to sphere max radius range (X, Y). how can I write C# code to implement it, many thanks for your help.

This is my current step:

step1: create 3D sphere, then I change sphrer position Z-axis to -10, scale value X is 35, Y is 1, Z is 35

Step2: create C# code append to sphere object

using UnityEngine;
using System.Collections;

public class MoveBoundary : MonoBehaviour {

	public Transform Ninja;   //Ninja Object

	// Update is called once per frame
	void Update () {
		Vector3 pos = Ninja.position;



add a circular collider in unity