コード例 #1
0
        // METHOD: GetRedlineSchedule
        //--------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the redline schedule
        /// </summary>
        /// 
        /// <returns>Queue of schedule info</returns>
        //--------------------------------------------------------------------------------------
        private Queue<ScheduleInfo> GetRedlineSchedule()
        {
            Queue<ScheduleInfo> redline = new Queue<ScheduleInfo>();
            ScheduleInfo info = new ScheduleInfo(Constants.StationNames.SHADYSIDE, 1.0);
            redline.Enqueue(info);
            info = new ScheduleInfo(Constants.StationNames.HERRONAVE, 1.0);
            redline.Enqueue(info);
            info = new ScheduleInfo(Constants.StationNames.SWISSVALE, 1.5);
            redline.Enqueue(info);
            info = new ScheduleInfo(Constants.StationNames.PENNSTATION, 1.8);
            redline.Enqueue(info);
            info = new ScheduleInfo(Constants.StationNames.STEELPLAZA, 2.1);
            redline.Enqueue(info);
            info = new ScheduleInfo(Constants.StationNames.FIRSTAVE, 2.1);
            redline.Enqueue(info);
            info = new ScheduleInfo(Constants.StationNames.STATIONSQUARE, 1.7);
            redline.Enqueue(info);
            info = new ScheduleInfo(Constants.StationNames.SOUTHHILLS, 2.3);
            redline.Enqueue(info);

            return redline;
        }
コード例 #2
0
        // METHOD: LeaveStation
        //--------------------------------------------------------------------------------------
        /// <summary>
        /// Close the doors, announce the next stop and notify train to leave the station
        /// </summary>
        //--------------------------------------------------------------------------------------
        private void LeaveStation()
        {
            // Close the doors
            m_myTrain.SetDoors(TrainState.Door.Closed);
            m_doorsOpen = false;

            // Announce the next stop
            m_nextStationInfo = m_routeInfo.Dequeue();
            m_myTrain.SetAnnouncement(m_nextStationInfo.StationName);

            // Notify train to leave the station
            m_atStation = false;

            m_timePassed = 0;
        }