internal static void ChangeRearBogieSection(Train Train, int CarIndex, int SectionIndex)
{
if (Train.Cars[CarIndex].RearBogie.CarSections.Length == 0)
{
Train.Cars[CarIndex].RearBogie.CurrentCarSection = -1;
//Hack: If no bogie objects are defined, just return
return;
}
for (int i = 0; i < Train.Cars[CarIndex].RearBogie.CarSections.Length; i++)
{
for (int j = 0; j < Train.Cars[CarIndex].RearBogie.CarSections[i].Elements.Length; j++)
{
int o = Train.Cars[CarIndex].RearBogie.CarSections[i].Elements[j].ObjectIndex;
Renderer.HideObject(o);
}
}
if (SectionIndex >= 0)
{
InitializeRearBogieSection(Train, CarIndex, SectionIndex);
for (int j = 0; j < Train.Cars[CarIndex].RearBogie.CarSections[SectionIndex].Elements.Length; j++)
{
int o = Train.Cars[CarIndex].RearBogie.CarSections[SectionIndex].Elements[j].ObjectIndex;
Renderer.ShowObject(o, Renderer.ObjectType.Dynamic);
}
}
Train.Cars[CarIndex].RearBogie.CurrentCarSection = SectionIndex;
UpdateRearBogieObjects(Train, CarIndex, 0.0, true);
}