Accesing Different Class Variables

Heyo, I find myself running into a bit of a problem right now. I am attempting to set up a primitive “follow” script where the “follower” will change movement based on a turnPoint variable (Which I have set up as a vector3) in which when the “follower” hits the turnPoint it will travel in whatever direction the “player” is going. In my player script which I will provide, whenever a directional button is pushed the current position gets stored into the turnPoint value.

My problem is accessing this ever changing value from another class or script which is attached to the “follower”. I’ve done some research and I’ve found that the GetComponent() function should work for this but I’m not finding any solid examples of this as most of the code I see is extremely vague, or isn’t fully explained. Could someone provide a better explanation of how to use this function properly?

Here is current script to control the “player”:

using UnityEngine;
using System.Collections;

public class PlayerControl : MonoBehaviour {
	
	public int length;
	public int speed;
	public bool isColliding;
	public int direction;
	public float timeStamp = 0.0F;
	public Vector3 turnPoint;
	
	void Start()
	{
		direction = Random.Range (1, 5);
		
		switch(direction)
		{
		case 1:
			moveDirection (1);
			break;
		case 2:
			moveDirection (2);
			break;
		case 3:
			moveDirection (3);
			break;
		case 4:
			moveDirection (4);
			break;
		default:
			Debug.Log ("Value of 5 was set for variable: direction");
			break;
		}
	}
	// Update is called once per frame
	void Update () 
	{
		if(isColliding == false)
		{
		moveDirection (direction);
		}
		
		if(Input.GetKey(KeyCode.UpArrow))
		{
			direction = 1;
			isColliding = false;
			if(Time.time > timeStamp + .5)
			{
				timeStamp = Time.time;
				turnPoint = transform.position;
				//Debug.Log(turnPoint);
			}
		}
		else if (Input.GetKey(KeyCode.DownArrow))
		{
			direction = 2;
			isColliding = false;
			if(Time.time > timeStamp + .5)
			{
				timeStamp = Time.time;
				turnPoint = transform.position;
				//Debug.Log(turnPoint);
			}
		}
		else if (Input.GetKey(KeyCode.LeftArrow))
		{
			direction = 3;
			isColliding = false;
			if(Time.time > timeStamp + .5)
			{
				timeStamp = Time.time;
				turnPoint = transform.position;
				//Debug.Log(turnPoint);
			}
		}
		else if (Input.GetKey(KeyCode.RightArrow))
		{
			direction = 4;
			isColliding = false;
			if(Time.time > timeStamp + .5)
			{
				timeStamp = Time.time;
				turnPoint = transform.position;
				//Debug.Log(turnPoint);
			}
		}
		
	}
	
	void moveDirection(int direction)
	{
		switch(direction)
		{
		case 1:
			transform.Translate (Vector3.forward * Time.deltaTime * speed);
			break;
		case 2:
			transform.Translate (-Vector3.forward * Time.deltaTime * speed);
			break;
		case 3:
			transform.Translate (Vector3.left * Time.deltaTime * speed);
			break;
		case 4:
			transform.Translate (Vector3.right * Time.deltaTime * speed);
			break;
		}
	}
	
	void OnTriggerEnter()
	{
		isColliding = true;
	}
	
	
}

unitygems.com first topic

http://docs.unity3d.com/Documentation/ScriptReference/index.Accessing_Other_Game_Objects.html