static private GetPluginSignal ( |
||
train | The train. | |
section | int | The absolute section index, referencing Game.Sections[]. |
return |
/// <summary>Called when the train passes a beacon.</summary> /// <param name="type">The beacon type.</param> /// <param name="sectionIndex">The section the beacon is attached to, or -1 if none, or TrackManager.TransponderSpecialSection.NextRedSection.</param> /// <param name="optional">Optional data attached to the beacon.</param> internal void UpdateBeacon(int type, int sectionIndex, int optional) { if (sectionIndex >= 0) { SignalData signal = Game.GetPluginSignal(this.Train, sectionIndex); 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> /// <param name="type">The beacon type.</param> /// <param name="sectionIndex">The section the beacon is attached to, or -1 for the next red signal.</param> /// <param name="optional">Optional data attached to the beacon.</param> 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))); } }