OpenBve.TrainManager.ChangeFrontBogieSection C# (CSharp) Method

ChangeFrontBogieSection() static private method

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