OpenBve.PluginManager.Plugin.UpdateBeacon C# (CSharp) Méthode

UpdateBeacon() private méthode

Called when the train passes a beacon.
private UpdateBeacon ( int type, int sectionIndex, int optional ) : void
type int The beacon type.
sectionIndex int The section the beacon is attached to, or -1 for the next red signal.
optional int Optional data attached to the beacon.
Résultat void
			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>

Usage Example

Exemple #1
0
 /// <inheritdoc/>
 public override void UpdateBeacon(int transponderType, int sectionIndex, int optional)
 {
     if (Plugin != null)
     {
         Plugin.UpdateBeacon(transponderType, sectionIndex, optional);
     }
 }