1 // ╔═════════════════════════════════════════════════════════════╗ 2 // ║ TrainManager.cs for the Route Viewer ║ 3 // ╠═════════════════════════════════════════════════════════════╣ 4 // ║ This file cannot be used in the openBVE main program. ║ 5 // ║ The file from the openBVE main program cannot be used here. ║ 6 // ╚═════════════════════════════════════════════════════════════╝ 7 8 using LibRender2; 9 using OpenBveApi; 10 using OpenBveApi.FileSystem; 11 using OpenBveApi.Hosts; 12 using OpenBveApi.Trains; 13 using TrainManager; 14 using TrainManager.Handles; 15 using TrainManager.Trains; 16 17 namespace RouteViewer { 18 19 internal class TrainManager : TrainManagerBase { 20 TrainManager(HostInterface host, BaseRenderer renderer, BaseOptions options, FileSystem fileSystem)21 public TrainManager(HostInterface host, BaseRenderer renderer, BaseOptions options, FileSystem fileSystem) : base(host, renderer, options, fileSystem) 22 { 23 } 24 25 // train 26 internal class Train : TrainBase { Train()27 internal Train() : base(TrainState.Pending) 28 { 29 Handles.Reverser = new ReverserHandle(this); 30 Handles.EmergencyBrake = new EmergencyHandle(this); 31 Handles.Power = new PowerHandle(8, 8, new double[] {}, new double[] {}, this); 32 Handles.Brake = new BrakeHandle(8, 8, null, new double[] {}, new double[] {}, this); 33 Handles.HoldBrake = new HoldBrakeHandle(this); 34 } 35 public override int NumberOfCars 36 { 37 get 38 { 39 return this.Cars.Length; 40 } 41 } 42 FrontCarTrackPosition()43 public override double FrontCarTrackPosition() 44 { 45 return Cars[0].FrontAxle.Follower.TrackPosition - Cars[0].FrontAxle.Position + 0.5 * Cars[0].Length; 46 } 47 RearCarTrackPosition()48 public override double RearCarTrackPosition() 49 { 50 return Cars[Cars.Length - 1].RearAxle.Follower.TrackPosition - Cars[Cars.Length - 1].RearAxle.Position - 0.5 * Cars[Cars.Length - 1].Length; 51 } 52 53 public override bool IsPlayerTrain 54 { 55 get 56 { 57 return true; 58 } 59 } 60 } 61 } 62 } 63