/// <summary> /// Constructor used by Crossroad, based on the constructor in Tile /// here all default values of the Crossroad are set. /// </summary> /// <param name="sim"></param> public Crossroad(SimControl sim) { this.name = "Crossroad"; this.lanes = new int[] { 1, 1, 1, 1, 1, 1, 1, 1 }; control = new TrafficlightControl(sim, this, 4, 5, lanes); directions.Add(1); directions.Add(2); directions.Add(3); directions.Add(4); int totalLanes = CountLanes(lanes); Initialize(); }
/// <summary> /// Constructor used by fork, based on the constructor in Tile /// here all default values of the Fork are set. /// </summary> /// <param name="sim"></param> /// <param name="notDirection"></param> public Fork(SimControl sim, int notDirection) { this.name = "Fork"; this.lanes = new int[] { 1, 1, 1, 1, 1, 1, 1, 1 }; this.notDirection = notDirection; lanes[notDirection * 2 - 2] = 0; lanes[notDirection * 2 - 1] = 0; directions.Add(1); directions.Add(2); directions.Add(3); directions.Add(4); directions.Remove(notDirection); control = new TrafficlightControl(sim, this, 3, notDirection, lanes); int totalLanes = CountLanes(lanes); Initialize(); }
/// <summary> /// Based on the method UpdateLanes in Tile /// this method is called when the lanes are updated. /// </summary> /// <param name="s"></param> /// <param name="direction"></param> /// <param name="lanesIn"></param> /// <param name="lanesOut"></param> public override void UpdateLanes(SimControl s, int direction, int lanesIn, int lanesOut) { if (directions.Contains(direction)) { lanes[direction * 2 - 1] = lanesOut; lanes[direction * 2 - 2] = lanesIn; } control = new TrafficlightControl(s, this, 3, NotDirection, lanes, position); }
/// <summary> /// Based on the method UpdateLanes in Tile /// this method is called when the lanes are updated. /// </summary> /// <param name="s"></param> /// <param name="direction"></param> /// <param name="lanesIn"></param> /// <param name="lanesOut"></param> public override void UpdateLanes(SimControl s, int direction, int lanesIn, int lanesOut) { lanes[direction * 2 - 1] = lanesOut; lanes[direction * 2 - 2] = lanesIn; control = new TrafficlightControl(s, this, 4, 5, lanes, position); }
public Crossroad() { tc = new TrafficlightControl(); }