コード例 #1
0
        /// <summary>
        /// Checks if this Rail is safe to enter for specific train.
        /// </summary>
        /// <returns>true if Rail is safe</returns>
        public bool IsClear()
        {
            bool clear = true;

            if (trains.Count > 0)
            {
                clear = false;
                if (station != null)
                {
                    if (station.CentralStation())
                    {
                        clear = true;
                    }
                }
            }
            if (wagons.Count > 0)
            {
                clear = false;
                Rail rail = wagons[0].Gettrain().GetRail();
                if (rail.GetStation() != null)
                {
                    if (rail.GetStation().CentralStation())
                    {
                        clear = true;
                    }
                }
            }
            return(clear);
        }
コード例 #2
0
ファイル: Train.cs プロジェクト: RobinvHoof/Proftaak2
 /// <summary>
 /// this train has arrived on a station
 /// </summary>
 public void Arrive()
 {
     inStation = true;
     SetNextDestination();
     rail.GetStation().AddTrain(this);
 }