private void UpdateFrontBackward(TrainManager.Train Train, bool UpdateTrain)
{
// update sections
if (this.PreviousSectionIndex >= 0)
{
Game.Sections[this.PreviousSectionIndex].Enter(Train);
Game.UpdateSection(this.PreviousSectionIndex);
}
if (this.NextSectionIndex >= 0)
{
Game.Sections[this.NextSectionIndex].Leave(Train);
Game.UpdateSection(this.NextSectionIndex);
}
if (UpdateTrain)
{
// update train
if (this.PreviousSectionIndex >= 0)
{
if (!Game.Sections[this.PreviousSectionIndex].Invisible)
{
Train.CurrentSectionIndex = this.PreviousSectionIndex;
}
}
else
{
Train.CurrentSectionLimit = double.PositiveInfinity;
Train.CurrentSectionIndex = -1;
}
}
}