• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Train类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Train的典型用法代码示例。如果您正苦于以下问题:C# Train类的具体用法?C# Train怎么用?C# Train使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Train类属于命名空间,在下文中一共展示了Train类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ApplyAirBrakeHandle

		/// <summary>Moves the air brake handle</summary>
		/// <param name="Train">The train</param>
		/// <param name="RelativeDirection">The direction: -1 for decrease, 1 for increase</param>
		internal static void ApplyAirBrakeHandle(Train Train, int RelativeDirection)
		{
			if (Train.Cars[Train.DriverCar].Specs.BrakeType == CarBrakeType.AutomaticAirBrake)
			{
				if (RelativeDirection == -1)
				{
					if (Train.Specs.AirBrake.Handle.Driver == AirBrakeHandleState.Service)
					{
						ApplyAirBrakeHandle(Train, AirBrakeHandleState.Lap);
					}
					else
					{
						ApplyAirBrakeHandle(Train, AirBrakeHandleState.Release);
					}
				}
				else if (RelativeDirection == 1)
				{
					if (Train.Specs.AirBrake.Handle.Driver == AirBrakeHandleState.Release)
					{
						ApplyAirBrakeHandle(Train, AirBrakeHandleState.Lap);
					}
					else
					{
						ApplyAirBrakeHandle(Train, AirBrakeHandleState.Service);
					}
				}
				Game.AddBlackBoxEntry(Game.BlackBoxEventToken.None);
			}
		}
开发者ID:leezer3,项目名称:OpenBVE,代码行数:32,代码来源:BrakeSystem.AirBrake.cs


示例2: enableTrainSound

 protected void enableTrainSound(Train train)
 {
     AudioSource audioSource = train.GetComponent<AudioSource>();
     if (audioSource) {
         audioSource.enabled = true;
     }
 }
开发者ID:alvarogzp,项目名称:nextation,代码行数:7,代码来源:AbstractTrainConfigurer.cs


示例3: retrieve

    protected override void retrieve()
    {
        string trainName = selectedTrainStorage.Get();
        selectedTrainStorage.Delete();

        train = retrieve(trainName);
    }
开发者ID:alvarogzp,项目名称:nextation,代码行数:7,代码来源:LocalTrainRetriever.cs


示例4: Ticket

 /// <summary>
 /// Инициализирует билет по поезду, в котором едет пассажир, типу вагона и
 /// пассажиру, который едет по этому билету. Устанавливает ссылки от себя 
 /// на поезд и на пассажира, а также  ссылки от поезда и от пассажира на себя.
 /// </summary>
 /// <param name="Train">Поезд, в котором едет пассажир.</param>
 /// <param name="Type">Тип вагона.</param>
 public Ticket(Train Train, string Type, Passenger Passenger)
 {
     _train      = Train;
     _type       = Type;
     _passenger  = Passenger;
     Associate(Train, Passenger);
 }
开发者ID:DrewYak,项目名称:ProjectTrains,代码行数:14,代码来源:ClassTicket.cs


示例5: TestInitialize

 [TestInitialize] public void TestInitialize() {
     TestDataFactory.Init();
     layout = TestDataFactory.Layout();
     stretch = layout.TrackStretches.First();
     train = TestDataFactory.CreateTrain1();
     target = new TrackStretchCoordinator(stretch);
 }
开发者ID:fjallemark,项目名称:TrainDispatch,代码行数:7,代码来源:TrackStretchCoordinatorTests.cs


示例6: Decrease

 public void Decrease(Train train, int passengersToDecrease)
 {
     if (!isSet(train)) {
         passengersPerTrain[train] = initialPassengers;
     }
     passengersPerTrain[train] -= passengersToDecrease;
 }
开发者ID:alvarogzp,项目名称:nextation,代码行数:7,代码来源:PerTrainStationPassengers.cs


示例7: ApplyReverser

		/// <summary>Applies a reverser notch</summary>
		/// <param name="Train">The train</param>
		/// <param name="Value">The notch to apply</param>
		/// <param name="Relative">Whether this is an absolute value or relative to the previous</param>
		internal static void ApplyReverser(Train Train, int Value, bool Relative)
		{
			int a = Train.Specs.CurrentReverser.Driver;
			int r = Relative ? a + Value : Value;
			if (r < -1) r = -1;
			if (r > 1) r = 1;
			if (a != r)
			{
				Train.Specs.CurrentReverser.Driver = r;
				if (Train.Plugin != null)
				{
					Train.Plugin.UpdateReverser();
				}
				Game.AddBlackBoxEntry(Game.BlackBoxEventToken.None);
				// sound
				if (a == 0 & r != 0)
				{
					Sounds.SoundBuffer buffer = Train.Cars[Train.DriverCar].Sounds.ReverserOn.Buffer;
					if (buffer == null) return;
					OpenBveApi.Math.Vector3 pos = Train.Cars[Train.DriverCar].Sounds.ReverserOn.Position;
					Sounds.PlaySound(buffer, 1.0, 1.0, pos, Train, Train.DriverCar, false);
				}
				else if (a != 0 & r == 0)
				{
					Sounds.SoundBuffer buffer = Train.Cars[Train.DriverCar].Sounds.ReverserOff.Buffer;
					if (buffer == null) return;
					OpenBveApi.Math.Vector3 pos = Train.Cars[Train.DriverCar].Sounds.ReverserOff.Position;
					Sounds.PlaySound(buffer, 1.0, 1.0, pos, Train, Train.DriverCar, false);
				}
			}
		}
开发者ID:leezer3,项目名称:OpenBVE,代码行数:35,代码来源:Reverser.cs


示例8: AddChange

			/// <summary>Adds a delayed handle state change</summary>
			/// <param name="Train">The train to add the delayed state change to</param>
			/// <param name="Value">The value to add or subtract</param>
			/// <param name="Delay">The delay in seconds</param>
			internal void AddChange(Train Train, int Value, double Delay)
			{
				int n = DelayedChanges.Length;
				Array.Resize<HandleChange>(ref DelayedChanges, n + 1);
				DelayedChanges[n].Value = Value;
				DelayedChanges[n].Time = Game.SecondsSinceMidnight + Delay;
			}
开发者ID:leezer3,项目名称:OpenBVE,代码行数:11,代码来源:Handles.cs


示例9: AddsFirstTimetableCall

        [TestMethod] public void AddsFirstTimetableCall() {
            var station = TestDataFactory.CreateStation1();
            var target = new Train(TrainCategory.Freight, "G1234");
            var call = new StationCall(station.Tracks.First(), new Time(12,30) , new Time(12,45));
            target.Add(call);

        }
开发者ID:fjallemark,项目名称:TrainDispatch,代码行数:7,代码来源:TrainTests.cs


示例10: Trainmovsegment

    public Trainmovsegment()
    {
        this.lvtrain_id = new Train();

        Clear();
        StopLocation.LoadList();
    }
开发者ID:eggopinheiro,项目名称:weboptimization,代码行数:7,代码来源:Trainmovsegment.cs


示例11: AddExistingTrainTest

 public void AddExistingTrainTest()
 {
     Administration admin = new Administration();
     Train train = new Train(1, 1);
     admin.Add(train);
     Assert.AreEqual(false, admin.Add(train));
 }
开发者ID:grasmanek94,项目名称:t22-4,代码行数:7,代码来源:Administration_Test.cs


示例12: WhenSecondTimetableCallIsAfterLastThenThrows

 public void WhenSecondTimetableCallIsAfterLastThenThrows() {
     var station = TestDataFactory.CreateStation1();
     var target = new Train(TrainCategory.Freight, "G1234");
     var call1 = new StationCall(station.Tracks.First(), new Time(12, 30), new Time(12, 45));
     var call2 = new StationCall(station.Tracks.First(), new Time(12, 50), new Time(12, 55));
     target.Add(call1);
     target.Add(call2);
 }
开发者ID:fjallemark,项目名称:TrainDispatch,代码行数:8,代码来源:TrainTests.cs


示例13: NextStationTest

 public void NextStationTest()
 {
     Station station = new Station("test");
     Train nextTrain = new Train(1, 2);
     station.NextTrain = nextTrain;
     Assert.AreEqual(nextTrain, station.NextTrain);
     Assert.AreEqual(1, nextTrain.TrainUnit);
 }
开发者ID:grasmanek94,项目名称:t22-4,代码行数:8,代码来源:Station_Test.cs


示例14: LastStationTest

 public void LastStationTest()
 {
     Station station = new Station("test");
     Train lastTrain = new Train(1, 2);
     station.LastTrain = lastTrain;
     Assert.AreEqual(lastTrain, station.LastTrain);
     Assert.AreEqual(1, lastTrain.TrainUnit);
 }
开发者ID:grasmanek94,项目名称:t22-4,代码行数:8,代码来源:Station_Test.cs


示例15: AddedTrainCanBeFoundTest

 public void AddedTrainCanBeFoundTest()
 {
     Administration admin = new Administration();
     Train train = new Train(1, 1);
     admin.Add(train);
     Train foundTrain = admin.FindTrain(1);
     Assert.AreEqual(foundTrain, train);
 }
开发者ID:grasmanek94,项目名称:t22-4,代码行数:8,代码来源:Administration_Test.cs


示例16: WriteTrain

 public void WriteTrain(string filename, Train train, BaseFormater formater)
 {
     Stream fs = new FileStream(filename, FileMode.Create);
     foreach (IFilter filter in filters)
         fs = filter.Apply(fs, FilterMode.Write);
     formater.WriteTrain(train, fs);
     fs.Close();
 }
开发者ID:Ozerich,项目名称:labs,代码行数:8,代码来源:FileStorage.cs


示例17: addPlayer

    private void addPlayer(Train train, NetworkPlayer owner, NetworkTrainPlayers players)
    {
        string newTrainName = RemoteTrainName.GetNameFor(train, owner);
        Train newTrain = clone(train, newTrainName);

        NetworkTrainPlayer player = NetworkTrainPlayerFactory.Create(newTrain, owner);
        players.AddPlayer(player);
    }
开发者ID:alvarogzp,项目名称:nextation,代码行数:8,代码来源:AddPlayerRpcCallReceiverProcessor.cs


示例18: ReadTrain

 public override Train ReadTrain(Stream stream)
 {
     sr = new BinaryReader(stream);
     Train train = new Train(sr.ReadInt32());
     int count = sr.ReadInt32();
     for (int i = 0; i < count; i++)
         train.AddCoach(ReadCoach());
     return train;
 }
开发者ID:Ozerich,项目名称:labs,代码行数:9,代码来源:BinaryFormatter.cs


示例19: ReadTrain

 public override Train ReadTrain(Stream stream)
 {
     sr = new StreamReader(stream);
     Train train = new Train(Int32.Parse(sr.ReadLine()));
     int count = Int32.Parse(sr.ReadLine());
     for (int i = 0; i < count; i++)
         train.AddCoach(ReadCoach());
     return train;
 }
开发者ID:Ozerich,项目名称:labs,代码行数:9,代码来源:TextFormatter.cs


示例20: UnderailTrain

		/// <summary>Un-derails a train</summary>
		/// <param name="Train">The train</param>
		internal static void UnderailTrain(Train Train)
		{
			Train.Derailed = false;
			for (int i = 0; i < Train.Cars.Length; i++)
			{
				Train.Cars[i].Specs.CurrentRollDueToTopplingAngle = 0.0;
				Train.Cars[i].Derailed = false;
			}
		}
开发者ID:leezer3,项目名称:OpenBVE,代码行数:11,代码来源:Functions.cs



注:本文中的Train类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TraitCollector类代码示例发布时间:2022-05-24
下一篇:
C# TradeType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap