public TrainSet nextTrackStatus(Track nextTrack) { return getTrackStatus()[nextTrack]; //if (getTrackStatus()[nextTrack] == null) //{ // return ; //} //else //{ // return false; //} }
public void moveCart(double amount) { if (currentTrack is StraightTrack || currentTrack is CornerTrack) { position += amount; if (position > 100) { position = position % 100; if (previousTrack == currentTrack.prevTrack) { previousTrack = currentTrack; currentTrack = currentTrack.nextTrack; } else { previousTrack = currentTrack; currentTrack = currentTrack.prevTrack; } } } else if (currentTrack is SwitchLeft || currentTrack is SwitchRight) { position += amount; if (position > 100) { position = position % 100; if (previousTrack == currentTrack.prevTrack) { if (currentTrack.turn) { previousTrack = currentTrack; currentTrack = currentTrack.switchTrack; } else { previousTrack = currentTrack; currentTrack = currentTrack.nextTrack; } } else { previousTrack = currentTrack; currentTrack = currentTrack.prevTrack; } } } //else if (currentTrack is SwitchRight) //{ // position += amount; // if (position > 100) // { // position = position % 100; // if (previousTrack == currentTrack.prevTrack) // { // if (currentTrack.turn) // { // previousTrack = currentTrack; // currentTrack = currentTrack.switchTrack; // } // else // { // previousTrack = currentTrack; // currentTrack = currentTrack.nextTrack; // } // } // else // { // previousTrack = currentTrack; // currentTrack = currentTrack.prevTrack; // } // } //} currentPos = currentTrack.calculatCartPosition(this); }
public Signal getNextSignal(Track nextTrack) { return findTrack(nextTrack.id).signal; }
public Sensor getNextSensor(Track nextTrack) { return findTrack(nextTrack.id).sensor; }
public Track getNextTrack(Track prevT) { if (this is SwitchLeft || this is SwitchRight) { if (nextTrack == prevT || switchTrack == prevT) return prevTrack; else if (prevTrack == prevT && turn) return switchTrack; else if (prevTrack == prevT && !turn) return nextTrack; } else { if (this.prevTrack.id == prevT.id) { return this.nextTrack; } else if (this.nextTrack.id == prevT.id) { return this.prevTrack; } } return null; }
public void addTrack(Track t) { rr.tracks.Add(t); }