Adding Vector3.Distance to door script.

okay I made a simple little c# script to open and close doors, the only problem is I want to make it so the player can only open/close said door when she is close to it (right now you can open/close it from across the room). I know I need to add Vector3.Distance to the script, but I can’t seem to get it working.

here is the script:

using UnityEngine;
using System.Collections;

public class OpenDoor : MonoBehaviour 
	bool  open = false; 
	AudioClip openSound;
	AudioClip closeSound;

	void OnMouseDown () {
			if (open) {
			Debug.Log ("Close");
			rigidbody.AddForce(transform.forward * 50);
			rigidbody.useGravity = true;
			open = false;
			if (closeSound)
		else {
			Debug.Log ("Open");
			rigidbody.AddForce(-transform.forward * 50);
			rigidbody.useGravity = true;
			open = true;
			if (openSound)

void OnMouseDown ()

float dist = Vector3.Distance(door.transform.position, player.transform.position);

if (dist < 2)
//do open and closing