moving train

hi i have a train and railway track and stations setup i just want that my train move from one station to other and stop also can someone please help me how can i move the train

@skgamer

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class TrackFollowingTrain : MonoBehaviour {

public GameObject waypointContainer;
public GameObject[] trainparts;
public AnimationCurve startCurve;

private List<Transform> waypoints;
public List<int> currentWaypoints;

public float speed = 0.1F;
public float currentSpeed;
private float startTime;
public int direction = 0;

// Use this for initialization
void Start () 
{
	for (int i = 0; i < trainparts.Length; i++) 
	{
		currentWaypoints.Add (0);
	}
	waypoints = GetWaypoints();
}

// Update is called once per frame
void FixedUpdate ()
{
	if (currentWaypoints[0] >= waypoints.Count || currentWaypoints[0] < 0) 
	{
		direction = 0;
	} 
	else 
	{
		for(int i = 0; i < trainparts.Length; i++) 
		{
			currentWaypoints <em>= MoveTransformTowardsWaypoint(trainparts_.transform, currentWaypoints*);*_</em>

* }*
* }*
* }*

* public void StartTrain()*
* {*
* speed = 5F;*
* if (currentWaypoints[0] < 10)*
* {*
* direction = 1;*
* for (int i = 0; i < currentWaypoints.Count; i++)*
_ currentWaypoints*++;
}
else if (direction == 0)
{
direction = -1;
for (int i = 0; i < currentWaypoints.Count; i++)
{
currentWaypoints–;
}
}
startTime = Time.time + 2.0F;
}*_

* List GetWaypoints ()*
* {*
* // This function takes the container object for the waypoints, then finds all of the transforms in it,*
* // once it has the transforms, it checks to make sure it’s not the container, and adds them to the list of waypoints.*

* Transform[] potentialWaypoints = waypointContainer.GetComponentsInChildren();*
* List waypoints = new List();*

* foreach (Transform potentialWaypoint in potentialWaypoints)*
* {*
* if (potentialWaypoint != waypointContainer.transform)*
* {*
* waypoints.Add(potentialWaypoint);*

* // correction for right rail, track width = 75 cm*
* Vector3 correction = new Vector3(0.375F, 0.0F, 0.0F);*
* potentialWaypoint.Translate(correction, Space.Self);*

* }*
* }*
* return waypoints;*
* }*

* int MoveTransformTowardsWaypoint(Transform tpartTF, int currentWaypoint)*
* {*
_ currentSpeed = speed * startCurve.Evaluate((Time.time-startTime) / 10);
float currentStep = currentSpeed * Time.smoothDeltaTime;_

* Vector3 movementVector = Vector3.MoveTowards(tpartTF.position,waypoints[currentWaypoint].position,currentStep);*
* float distance = Vector3.Distance(tpartTF.position, movementVector);*

* if (currentStep-distance> 0.001)*
* {*
* // if this increment passes the waypoint, we move towards the next waypoint instead*
* currentWaypoint += direction;*
* if (currentWaypoint >= 0 && currentWaypoint < waypoints.Count)*
* {*
* movementVector = Vector3.MoveTowards(tpartTF.position,waypoints[currentWaypoint].position,currentStep);*
* }*
* else*
* {*
* return currentWaypoint;*
* }*
* }*

* tpartTF.position = movementVector;*
* tpartTF.LookAt(waypoints[currentWaypoint]);*
* return currentWaypoint;*
* }*
}strong text