本文整理汇总了C#中Train类的典型用法代码示例。如果您正苦于以下问题:C# Train类的具体用法?C# Train怎么用?C# Train使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Train类属于命名空间,在下文中一共展示了Train类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: enableTrainSound
protected void enableTrainSound(Train train)
{
AudioSource audioSource = train.GetComponent<AudioSource>();
if (audioSource) {
audioSource.enabled = true;
}
}
示例3: retrieve
protected override void retrieve()
{
string trainName = selectedTrainStorage.Get();
selectedTrainStorage.Delete();
train = retrieve(trainName);
}
示例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);
}
示例5: TestInitialize
[TestInitialize] public void TestInitialize() {
TestDataFactory.Init();
layout = TestDataFactory.Layout();
stretch = layout.TrackStretches.First();
train = TestDataFactory.CreateTrain1();
target = new TrackStretchCoordinator(stretch);
}
示例6: Decrease
public void Decrease(Train train, int passengersToDecrease)
{
if (!isSet(train)) {
passengersPerTrain[train] = initialPassengers;
}
passengersPerTrain[train] -= passengersToDecrease;
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例10: Trainmovsegment
public Trainmovsegment()
{
this.lvtrain_id = new Train();
Clear();
StopLocation.LoadList();
}
示例11: AddExistingTrainTest
public void AddExistingTrainTest()
{
Administration admin = new Administration();
Train train = new Train(1, 1);
admin.Add(train);
Assert.AreEqual(false, admin.Add(train));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}