Ejemplo n.º 1
0
        private void LightTimer_Tick(object sender, EventArgs e)
        {
            //Attention phase
            if (CurrentPhase == TrafficPhase.Go)
            {
                CurrentPhase        = TrafficPhase.Attention;
                LightTimer.Interval = 3000;
            }
            //Stop phase
            else if (CurrentPhase == TrafficPhase.Attention)
            {
                CurrentPhase        = TrafficPhase.Stop;
                LightTimer.Interval = 6000;
            }

            //Prepare Phase
            else if (CurrentPhase == TrafficPhase.Stop)
            {
                CurrentPhase        = TrafficPhase.Prepare;
                LightTimer.Interval = 2000;
            }
            //return to Go Phase
            else if (CurrentPhase == TrafficPhase.Prepare)
            {
                CurrentPhase = TrafficPhase.Go;
                LightTimer.Stop();
            }
        }
Ejemplo n.º 2
0
        private void ChangeCoefficients()
        {
            int mNest = int.Parse(MText.Text);
            int nNest = int.Parse(NText.Text);

            triangles = GenerateTriangles(nNest, mNest);

            if (CoefficientSameValueRadioButton.Checked)
            {
                double kd = kdTrackBar.Value * 0.01;
                double ks = ksTrackBar.Value * 0.01;
                double m  = mTrackBar.Value;

                triangles.WriteAllCoefficienst(kd, ks, m);
            }
            else
            {
                triangles.WriteRandomCoefficients();
            }

            if (LConstRadioButton.Checked)
            {
                LightTimer.Stop();
            }
            else
            {
                LightTimer.Start();
            }

            if (PreciselyFillRadioButton.Checked)
            {
                current_mode = PaintMode.Normal;
            }
            else if (InterpolationFillRadioButton.Checked)
            {
                current_mode = PaintMode.Interpolate;
            }
            else if (HybridFillRadioButton.Checked)
            {
                current_mode = PaintMode.HybridInterpolate;
            }

            isColorFromTexture       = TextureColorRadioButton.Checked;
            isNormalVectorFromMap    = NFromTextureRadioButton.Checked;
            isNormalVectorFromBubble = BubbleRadioButton.Checked;
            lightColor = LightColor.BackColor;
        }
Ejemplo n.º 3
0
        private TrafficPhase GoToNextPhase()
        {
            //Switch between phases depending on the Current phase

            switch (CurrentPhase)
            {
            case TrafficPhase.Go: return(TrafficPhase.Attention);

            case TrafficPhase.Attention: return(TrafficPhase.Stop);

            case TrafficPhase.Stop: return(TrafficPhase.Prepare);

            default:
                LightTimer.Stop();
                lblCountDown.Visible = false;
                return(TrafficPhase.Go);
            }
        }
Ejemplo n.º 4
0
        private void LightTimer_Tick(object sender, EventArgs e)
        {
            //Attention phase
            if (CurrentPhase == TrafficPhase.Go)
            {
                CurrentPhase = TrafficPhase.Attention;
                RedLight.SetState(LampState.Off);
                YellowLight.SetState(LampState.On);
                GreenLight.SetState(LampState.Off);
                LightTimer.Interval = 3000;
            }
            //Stop phase
            else if (CurrentPhase == TrafficPhase.Attention)
            {
                CurrentPhase = TrafficPhase.Stop;
                RedLight.SetState(LampState.On);
                YellowLight.SetState(LampState.Off);//LightStateOff();
                GreenLight.SetState(LampState.Off);
                LightTimer.Interval = 6000;
            }
            //Prepare Phase

            else if (CurrentPhase == TrafficPhase.Stop)
            {
                CurrentPhase = TrafficPhase.Prepare;
                RedLight.SetState(LampState.On);
                YellowLight.SetState(LampState.On);
                GreenLight.SetState(LampState.Off);
                LightTimer.Interval = 2000;
            }
            else if (CurrentPhase == TrafficPhase.Prepare)
            {
                CurrentPhase = TrafficPhase.Go;
                RedLight.SetState(LampState.Off);
                YellowLight.SetState(LampState.Off);
                GreenLight.SetState(LampState.On);
                LightTimer.Stop();
            }
        }
Ejemplo n.º 5
0
        private void LightTimer_Tick(object sender, EventArgs e)
        {
            //Attention phase
            if (CurrentPhase == TrafficPhase.Go)
            {
                CurrentPhase        = TrafficPhase.Attention;
                GreenLight.Image    = Properties.Resources.DarkGreen;
                YellowLight.Image   = Properties.Resources.LightYellow;
                RedLight.Image      = Properties.Resources.DarkRed;
                LightTimer.Interval = 3000;
            }
            //Stop phase
            else if (CurrentPhase == TrafficPhase.Attention)
            {
                CurrentPhase        = TrafficPhase.Stop;
                GreenLight.Image    = Properties.Resources.DarkGreen;
                YellowLight.Image   = Properties.Resources.DarkYellow;
                RedLight.Image      = Properties.Resources.LightRed;
                LightTimer.Interval = 6000;
            }
            //Prepare Phase

            else if (CurrentPhase == TrafficPhase.Stop)
            {
                CurrentPhase        = TrafficPhase.Prepare;
                GreenLight.Image    = Properties.Resources.DarkGreen;
                YellowLight.Image   = Properties.Resources.LightYellow;
                RedLight.Image      = Properties.Resources.LightRed;
                LightTimer.Interval = 2000;
            }
            else if (CurrentPhase == TrafficPhase.Prepare)
            {
                CurrentPhase      = TrafficPhase.Go;
                GreenLight.Image  = Properties.Resources.LightGreen;
                YellowLight.Image = Properties.Resources.DarkYellow;
                RedLight.Image    = Properties.Resources.DarkRed;
                LightTimer.Stop();
            }
        }