2024-10-09 22:54:28 +02:00
|
|
|
|
using OpenBveApi.Runtime;
|
|
|
|
|
|
|
|
|
|
namespace OpenbveFcmbTrainPlugin
|
|
|
|
|
{
|
|
|
|
|
/// <summary>Represents an abstract device.</summary>
|
|
|
|
|
internal abstract class Device
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/// <summary>The power notch requested by the device.</summary>
|
|
|
|
|
internal int RequestedPowerNotch = -1;
|
|
|
|
|
|
|
|
|
|
/// <summary>The brake notch requested by the device.</summary>
|
|
|
|
|
internal int RequestedBrakeNotch = -1;
|
|
|
|
|
|
|
|
|
|
/// <summary>The door interlock requested by the device.</summary>
|
|
|
|
|
internal DoorInterlockStates RequestedDoorInterlock;
|
|
|
|
|
|
|
|
|
|
/// <summary>Is called when the device state should be updated.</summary>
|
|
|
|
|
/// <param name="train">The current train.</param>
|
2024-10-13 00:31:40 +02:00
|
|
|
|
/// <param name="route">The current route.</param>
|
2024-10-09 22:54:28 +02:00
|
|
|
|
/// <param name="init">Whether the device should initialize.</param>
|
|
|
|
|
/// <param name="elapsedTime">The time elapsed since the previous call.</param>
|
2024-10-13 00:31:40 +02:00
|
|
|
|
internal virtual void Update(Train train, Route route, bool init, Time elapsedTime) { }
|
2024-10-09 22:54:28 +02:00
|
|
|
|
|
|
|
|
|
/// <summary>Is called when the driver changes the reverser.</summary>
|
|
|
|
|
/// <param name="reverser">The new reverser position.</param>
|
|
|
|
|
internal virtual void SetReverser(int reverser) { }
|
|
|
|
|
|
|
|
|
|
/// <summary>Is called when the driver changes the power notch.</summary>
|
|
|
|
|
/// <param name="powerNotch">The new power notch.</param>
|
|
|
|
|
internal virtual void SetPower(int powerNotch) { }
|
|
|
|
|
|
|
|
|
|
/// <summary>Is called when the driver changes the brake notch.</summary>
|
|
|
|
|
/// <param name="brakeNotch">The new brake notch.</param>
|
|
|
|
|
internal virtual void SetBrake(int brakeNotch) { }
|
|
|
|
|
|
|
|
|
|
/// <summary>Is called when the state of a key changes.</summary>
|
|
|
|
|
/// <param name="key">The key.</param>
|
|
|
|
|
/// <param name="pressed">Whether the key is pressed or released.</param>
|
|
|
|
|
/// <param name="train">The current train.</param>
|
|
|
|
|
internal virtual void KeyChange(VirtualKeys key, bool pressed, Train train) { }
|
|
|
|
|
|
|
|
|
|
/// <summary>Is called when the state of the doors changes.</summary>
|
|
|
|
|
/// <param name="oldState">The old state of the doors.</param>
|
|
|
|
|
/// <param name="newState">The new state of the doors.</param>
|
|
|
|
|
internal virtual void DoorChange(DoorStates oldState, DoorStates newState) { }
|
|
|
|
|
|
|
|
|
|
/// <summary>Is called when a horn is played or when the music horn is stopped.</summary>
|
|
|
|
|
/// <param name="type">The type of horn.</param>
|
|
|
|
|
internal virtual void HornBlow(HornTypes type) { }
|
|
|
|
|
|
|
|
|
|
/// <summary>Is called to inform about signals.</summary>
|
|
|
|
|
/// <param name="signal">The signal data.</param>
|
|
|
|
|
internal virtual void SetSignal(SignalData[] signal) { }
|
|
|
|
|
|
|
|
|
|
/// <summary>Is called when a beacon is passed.</summary>
|
|
|
|
|
/// <param name="beacon">The beacon data.</param>
|
|
|
|
|
internal virtual void SetBeacon(BeaconData beacon) { }
|
|
|
|
|
|
|
|
|
|
/// <summary>Is called when the plugin should perform the AI.</summary>
|
|
|
|
|
/// <param name="data">The AI data.</param>
|
|
|
|
|
/// <param name="train">The current train.</param>
|
2024-10-13 00:31:40 +02:00
|
|
|
|
/// <param name="route">The current route.</param>
|
|
|
|
|
internal virtual void PerformAI(AIData data, Train train, Route route) { }
|
2024-10-09 22:54:28 +02:00
|
|
|
|
}
|
|
|
|
|
}
|