internal void UpdateBeacon(int type, int sectionIndex, int optional) {
if (sectionIndex == -1) {
sectionIndex = this.Train.CurrentSectionIndex + 1;
SignalData signal = null;
while (sectionIndex < Game.Sections.Length) {
signal = Game.GetPluginSignal(this.Train, sectionIndex);
if (signal.Aspect == 0) break;
sectionIndex++;
}
if (sectionIndex < Game.Sections.Length) {
SetBeacon(new BeaconData(type, optional, signal));
} else {
SetBeacon(new BeaconData(type, optional, new SignalData(-1, double.MaxValue)));
}
}
if (sectionIndex >= 0) {
SignalData signal;
if (sectionIndex < Game.Sections.Length) {
signal = Game.GetPluginSignal(this.Train, sectionIndex);
} else {
signal = new SignalData(0, double.MaxValue);
}
SetBeacon(new BeaconData(type, optional, signal));
} else {
SetBeacon(new BeaconData(type, optional, new SignalData(-1, double.MaxValue)));
}
}
/// <summary>Called when the train passes a beacon.</summary>