// Use this for initialization
    void Start()
    {
        Train.transform.position = StartLocation;
        trainMoveState           = TrainMoveState.Waiting;
        advancementTimer         = RoundResetTime;

        StartCoroutine(TrainSchedulerRoutine());
    }
 IEnumerator TrainSchedulerRoutine()
 {
     while (true)
     {
         advancementTimer -= Time.deltaTime;
         if (advancementTimer <= 0)
         {
             if (trainMoveState == TrainMoveState.Waiting)
             {
                 ArrivalLight.GetComponent <SpriteRenderer>().color = new Color(0, 1, 0);
                 Debug.Log("Arriving");
                 trainMoveState = TrainMoveState.Arriving;
                 Train.GetComponent <TrainBehaviour>().SetDestination(BoardingPlatform, TrainTravelingTime, DoorOpenTime);
                 advancementTimer = TrainTravelingTime + DoorOpenTime;
             }
             else if (trainMoveState == TrainMoveState.Arriving)
             {
                 ArrivalLight.GetComponent <SpriteRenderer>().color = new Color(1, 0, 0);
                 Debug.Log("Loading");
                 trainMoveState   = TrainMoveState.Loading;
                 advancementTimer = TrainLoadingTime;
             }
             else if (trainMoveState == TrainMoveState.Loading)
             {
                 DepartureLight.GetComponent <SpriteRenderer>().color = new Color(0, 1, 0);
                 Debug.Log("Departing");
                 trainMoveState = TrainMoveState.Departing;
                 Train.GetComponent <TrainBehaviour>().SetDestination(FinalStop, TrainTravelingTime, DoorOpenTime);
                 advancementTimer = TrainTravelingTime + DoorOpenTime;
             }
             else if (trainMoveState == TrainMoveState.Departing)
             {
                 DepartureLight.GetComponent <SpriteRenderer>().color = new Color(1, 0, 0);
                 Debug.Log("Waiting");
                 trainMoveState           = TrainMoveState.Waiting;
                 Train.transform.position = StartLocation;
                 Train.GetComponent <TrainBehaviour>().SetDestination(StartLocation);
                 advancementTimer = RoundResetTime;
             }
         }
         yield return(new WaitForEndOfFrame());
     }
 }