private static void UpdateFrontBogieSectionElement(Train Train, int CarIndex, int SectionIndex, int ElementIndex, Vector3 Position, Vector3 Direction, Vector3 Up, Vector3 Side, bool Show, double TimeElapsed, bool ForceUpdate)
{
{
Vector3 p;
if (Train.Cars[CarIndex].FrontBogie.CarSections[SectionIndex].Overlay &
World.CameraRestriction != World.CameraRestrictionMode.NotAvailable)
{
//Should never be hit, as a bogie cannot be a cab object
p = new Vector3(Train.Cars[CarIndex].DriverX, Train.Cars[CarIndex].DriverY, Train.Cars[CarIndex].DriverZ);
}
else
{
p = Position;
}
double timeDelta;
bool updatefunctions;
if (Train.Cars[CarIndex].FrontBogie.CarSections[SectionIndex].Elements[ElementIndex].RefreshRate != 0.0)
{
if (Train.Cars[CarIndex].FrontBogie.CarSections[SectionIndex].Elements[ElementIndex].SecondsSinceLastUpdate >=Train.Cars[CarIndex].FrontBogie.CarSections[SectionIndex].Elements[ElementIndex].RefreshRate)
{
timeDelta =
Train.Cars[CarIndex].FrontBogie.CarSections[SectionIndex].Elements[ElementIndex].SecondsSinceLastUpdate;
Train.Cars[CarIndex].FrontBogie.CarSections[SectionIndex].Elements[ElementIndex].SecondsSinceLastUpdate =
TimeElapsed;
updatefunctions = true;
}
else
{
timeDelta = TimeElapsed;
Train.Cars[CarIndex].FrontBogie.CarSections[SectionIndex].Elements[ElementIndex].SecondsSinceLastUpdate += TimeElapsed;
updatefunctions = false;
}
}
else
{
timeDelta = Train.Cars[CarIndex].FrontBogie.CarSections[SectionIndex].Elements[ElementIndex].SecondsSinceLastUpdate;
Train.Cars[CarIndex].FrontBogie.CarSections[SectionIndex].Elements[ElementIndex].SecondsSinceLastUpdate = TimeElapsed;
updatefunctions = true;
}
if (ForceUpdate)
{
updatefunctions = true;
}
ObjectManager.UpdateAnimatedObject(ref Train.Cars[CarIndex].FrontBogie.CarSections[SectionIndex].Elements[ElementIndex], true, Train, CarIndex,Train.Cars[CarIndex].FrontBogie.CurrentCarSection,Train.Cars[CarIndex].FrontBogie.FrontAxle.Follower.TrackPosition - Train.Cars[CarIndex].RearBogie.FrontAxlePosition, p, Direction, Up,Side, Train.Cars[CarIndex].FrontBogie.CarSections[SectionIndex].Overlay, updatefunctions, Show, timeDelta);
}
}