// For each TPU set left and right TPunit wich is Active at the moment public void SetEachPathClosePaths() { for (int i = 0; i < TrackList.Length; i++) { TrackPathUnit track = TrackList [i]; track.SetOwnClosePaths(); } }
public void SetTrainProperties(Train train) { //Start TPU if (train.TrainDirection == -1) { startTrack = TrackPath.Instance.GetTrackPathUnitByName(Constants.TRACK_I_RIGHT); } else { startTrack = TrackPath.Instance.GetTrackPathUnitByName(Constants.TRACK_I_LEFT); } //out TPU outTrack = TrackPath.Instance.GetTrackPathUnitByName(startTrack.name.Equals(Constants.TRACK_I_RIGHT) ? Constants.TRACK_I_LEFT : Constants.TRACK_I_RIGHT); }
public void GetTrackPath(RollingStock car) { PathMade++; ClearPath(car); // if we change swithces in indication mode if (IndicationManager.Instance.IsPathIndicate) { IndicationManager.Instance.TurnPathIndicationOff(); IndicationManager.Instance.IsPathIndicate = true; } SetEachPathClosePaths(); TrackPathUnit currentTrack = car.OwnTrack; tempLeft = currentTrack.LeftTrackPathUnit; tempRight = currentTrack.RightTrackPathUnit; count = Constants.PATHS_NUM / 2; countLeft = count; countRight = count; TrackPathUnit [] pathOwn = new TrackPathUnit [Constants.PATHS_NUM]; pathOwn [count] = currentTrack; while (tempLeft != null || tempRight != null) { if (tempLeft != null) { pathOwn[countLeft - 1] = tempLeft; countLeft--; tempLeft = tempLeft.LeftTrackPathUnit; } if (tempRight != null) { pathOwn [countRight + 1] = tempRight; countRight++; tempRight = tempRight.RightTrackPathUnit; } } car.SetPathToRS(pathOwn, countLeft, countRight); PathMade--; // if all paths of all compositions are made if (PathMade == 0) { print("PathMade"); EventManager.PathUpdated(); } }
public void GetRightTrafficLight() { rightTL = null; //get comp path TrackPathUnit [] paths = rsComposition.CarComposition.MainCar.OwnPath; currentPath = rsComposition.CarComposition.MainCar.OwnTrack; int stop = rsComposition.CarComposition.MainCar.LastTrackIndex; int start = Array.IndexOf(paths, currentPath); for (int i = start; i <= stop; i++) { TrafficLight tl = paths [i].TrackCircuit.TrackLights [1]; if (tl && tl.IsClosed) { rightTL = tl; return; } } }
public TrackPathUnit GetPrevTrack(TrackPathUnit _current, TrackPathUnit [] _path) { return(_current.LeftTrackPathUnit); }
public TrackPathUnit GetNextTrack(TrackPathUnit _current, TrackPathUnit [] _path) { return(_current.RightTrackPathUnit); }