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(); } }
// Update is called once per frame void Update() { pos = this.transform.position; PauseTimer.updateTimer(Time.deltaTime); AttackTimer.updateTimer(Time.deltaTime); LightTimer.updateTimer(Time.deltaTime); if (player.getposition().x < pos.x) { sr.flipX = false; if (player.getposition().y < 6 && pos.x > (initialx - 12) && pos.x <= initialx) { transform.Translate(Vector2.left * speed / 10); } } if (player.getposition().x > pos.x) { sr.flipX = true; if (player.getposition().y < 6 && pos.x > (initialx - 12) && pos.x <= initialx) { transform.Translate(Vector2.right * speed / 10); } } //For the pause and the light if (wait && PauseTimer.stopped()) { isattacking = true; wait = false; AttackTimer.startTimer(); anim.CrossFade("attack", 0f); GameObject.Find("Light").GetComponent <Light> ().intensity = 1.3f; } if (!wait && AttackTimer.stopped()) { isattacking = false; wait = true; PauseTimer.startTimer(); anim.CrossFade("Idle", 0f); LightTimer.startTimer(); } if (wait && LightTimer.stopped()) { GameObject.Find("Light").GetComponent <Light> ().intensity = 3.0f; } if (healthManager.dead()) { Instantiate(FlowerPrefabs, FlowerInstantiate.transform.position, FlowerInstantiate.rotation); Destroy(background_before); targetSliderOject.SetActive(false); Destroy(gameObject); } }
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; }
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); } }
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(); } }
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(); } }
private void StopButton_Click(object sender, EventArgs e) { //start the Attention phase by calling 'LightTimer' LightTimer.Interval = 6000; LightTimer.Start(); }
private void StopButton_Click(object sender, EventArgs e) { //start the Attention phase by calling 'LightTimer' lblCountDown.Visible = true; LightTimer.Start(); }