public YellowLight() : base(
         ColourOptions.YellowOnly,
         StatusOptions.HandlingTraffic,
         TIME_TO_WAIT_ON_YELLOW,
         StateTransition.Replace(new RedLightPausedBeforeWaitingForTraffic()))
 {
 }
Exemple #2
0
 public RedAndYellowLight() : base(
         ColourOptions.RedAndYellow,
         StatusOptions.HandlingTraffic,
         TIME_TO_WAIT_ON_RED_AND_YELLOW,
         StateTransition.Replace(new GreenLight()))
 {
 }
 public GreenLight() : base(
         ColourOptions.GreenOnly,
         StatusOptions.HandlingTraffic,
         TIME_TO_STAY_ON_GREEN,
         StateTransition.Replace(new YellowLight()))
 {
 }
        /// <summary>
        /// This will represent the passing of an arbitrary slice of time. The "real time" duration of it is not important, its duration could be decreased or
        /// increased to make the simulation proceed more quickly or more slowly.
        /// </summary>
        public StateTransition RegisterPassageOfTime()
        {
            if (_isAllowedToLetTrafficThrough())
            {
                return(StateTransition.Replace(new RedAndYellowLight()));
            }

            return(StateTransition.NoChange());
        }
 public RedLightAboutToChange() : base(
         ColourOptions.RedOnly,
         StatusOptions.HandlingTraffic,         // We're committed to letting traffic pass at this point so declare HandlingTraffic
         TIME_TO_STAY_RED_AFTER_CAR_ARRIVES, StateTransition.Replace(new RedAndYellowLight()))
 {
 }