private void Tab2btnFindPeriodLC_Click(object sender, EventArgs e) { Tab2txtResult.Clear(); Application.DoEvents(); Tab2txtResult.AppendText("Starting to compute first 50000 stream output.\r\n"); for (int i = 0; i < 50000; i++) { L1.Clock(); L2.Clock(); L3.Clock(); L4.Clock(); NonlinCombOutput += NonLinearCombiner(L1.StreamOutput, L2.StreamOutput, L3.StreamOutput, L4.StreamOutput).Value.ToString(); } Tab2txtResult.AppendText("Stream has been generated.\r\nStarting to compute period.\r\n"); Application.DoEvents(); int period = LFSRTools.FindStreamPeriodExtended(NonlinCombOutput, 3 + 4 + 5 + 7); Tab2txtResult.AppendText("\r\nPeriod is " + period + ".\r\n"); int LCbound = NonLinearCombinerStar(L1.FeedbackPolynomial.Degree, L2.FeedbackPolynomial.Degree, L3.FeedbackPolynomial.Degree, L4.FeedbackPolynomial.Degree); Tab2txtResult.AppendText("\r\nLC is bounded by " + LCbound + "."); }
private void button4_Click(object sender, EventArgs e) { L4 l4 = new L4(); l4.Show(); this.Hide(); }
// Update is called once per frame void Update() { countFrames++; //lava raises and stays for this long if (countFrames >= 1725 && countFrames <= 2150 && hasRaised == false) { if (countFrames % 10 == 0) { L1.SetActive(true); L2.SetActive(true); L3.SetActive(true); L4.SetActive(true); text.SetActive(true); } if (countFrames % 30 == 0) { L1.SetActive(false); L2.SetActive(false); L3.SetActive(false); L4.SetActive(false); text.SetActive(false); } } if (countFrames == 2150 && hasRaised == false) { countFrames = 0; L1.SetActive(false); L2.SetActive(false); L3.SetActive(false); L4.SetActive(false); text.SetActive(false); hasRaised = true; } //Keeps it lined up with the lava if (countFrames == 450 && hasRaised == true) { countFrames = 0; hasRaised = false; } }
private void frm_PSC_CG_Load(object sender, EventArgs e) { dgv.Rows.Clear(); dgv.Rows.Add("Distance (m)", L1.ToString("f3"), L2.ToString("f3"), L3.ToString("f3"), L4.ToString("f3"), L5.ToString("f3"), L6.ToString("f3"), L7.ToString("f3"), L8.ToString("f3"), L9.ToString("f3")); dgv.Rows.Add("Cable 'e' (mm)", Cable_E.F1.ToString("f3"), Cable_E.F2.ToString("f3"), Cable_E.F3.ToString("f3"), Cable_E.F4.ToString("f3"), Cable_E.F5.ToString("f3"), Cable_E.F6.ToString("f3"), Cable_E.F7.ToString("f3"), Cable_E.F8.ToString("f3"), Cable_E.F9.ToString("f3")); dgv.Rows.Add("Cable 'd' (mm)", Cable_D.F1.ToString("f3"), Cable_D.F2.ToString("f3"), Cable_D.F3.ToString("f3"), Cable_D.F4.ToString("f3"), Cable_D.F5.ToString("f3"), Cable_D.F6.ToString("f3"), Cable_D.F7.ToString("f3"), Cable_D.F8.ToString("f3"), Cable_D.F9.ToString("f3")); dgv.Rows.Add("Cable 'c' (mm)", Cable_C.F1.ToString("f3"), Cable_C.F2.ToString("f3"), Cable_C.F3.ToString("f3"), Cable_C.F4.ToString("f3"), Cable_C.F5.ToString("f3"), Cable_C.F6.ToString("f3"), Cable_C.F7.ToString("f3"), Cable_C.F8.ToString("f3"), Cable_C.F9.ToString("f3")); dgv.Rows.Add("Cable 'b' (mm)", Cable_B.F1.ToString("f3"), Cable_B.F2.ToString("f3"), Cable_B.F3.ToString("f3"), Cable_B.F4.ToString("f3"), Cable_B.F5.ToString("f3"), Cable_B.F6.ToString("f3"), Cable_B.F7.ToString("f3"), Cable_B.F8.ToString("f3"), Cable_B.F9.ToString("f3")); dgv.Rows.Add("Cable 'a' (mm)", Cable_A.F1.ToString("f3"), Cable_A.F2.ToString("f3"), Cable_A.F3.ToString("f3"), Cable_A.F4.ToString("f3"), Cable_A.F5.ToString("f3"), Cable_A.F6.ToString("f3"), Cable_A.F7.ToString("f3"), Cable_A.F8.ToString("f3"), Cable_A.F9.ToString("f3")); //Average Cable_CG = ((Cable_A + Cable_B + Cable_C + Cable_D + Cable_E) / 5.0); dgv.Rows.Add("CG", Cable_CG.F1.ToString("f3"), Cable_CG.F2.ToString("f3"), Cable_CG.F3.ToString("f3"), Cable_CG.F4.ToString("f3"), Cable_CG.F5.ToString("f3"), Cable_CG.F6.ToString("f3"), Cable_CG.F7.ToString("f3"), Cable_CG.F8.ToString("f3"), Cable_CG.F9.ToString("f3")); dgv.Rows[0].ReadOnly = true; dgv.Rows[0].Frozen = true; dgv.Rows[0].DefaultCellStyle.ForeColor = Color.Blue; dgv.Rows[6].ReadOnly = true; dgv.Rows[6].Frozen = true; dgv.Rows[6].DefaultCellStyle.ForeColor = Color.Blue; }
public override void Update() { Total = L1.GetComponent <Levier>().ValeurL1 + L2.GetComponent <Levier>().ValeurL2 + L3.GetComponent <Levier>().ValeurL3 + L4.GetComponent <Levier>().ValeurL4; print("Valeur Solution: " + Solution); print("Valeur Levier: " + Total); if (CanOpen) { if (maxOpen < 180 && maxOpen > 0) { if (transform.localEulerAngles.y < maxOpen) { transform.Rotate(new Vector3(0, 100, 0) * Time.deltaTime); } else { base.Declencher_Etape_Suivante_Du_Scenario(); } } if (maxOpen >= 180) { if (transform.localEulerAngles.y <= 45 && transform.localEulerAngles.y > 0 || transform.localEulerAngles.y > maxOpen) { transform.Rotate(new Vector3(0, -100, 0) * Time.deltaTime); } else { base.Declencher_Etape_Suivante_Du_Scenario(); } } } }
// Update is called once per frame void Update() { if (doorOpenInCurrentLoop) { door.SetActive(false); } else if (M.stepCount > 1) { door.SetActive(true); } if (loopCount == 1) { doorOpenInCurrentLoop = true; } if (loopCount == 2) { if (AudiSou.volume <= 0.1) { if (!c2p) { c2p = true; Debug.Log("Swapping Tracks"); AudiSou.clip = c2; AudiSou.Play(); } } else if (c1 == AudiSou.clip) { fadeOut(c1, AudiSou, c2); } if (c2p) { fadeIn(AudiSou); } t1.gameObject.SetActive(true); t2.gameObject.SetActive(true); if (t1.touch == true && t2.touch == true) { doorOpenInCurrentLoop = true; } } if (loopCount == 3) { t3.gameObject.SetActive(true); t4.gameObject.SetActive(true); if (t1.touch == true && t2.touch == true && t3.touch == true && t4.touch == true) { doorOpenInCurrentLoop = true; } } if (loopCount == 4) { stepObject.SetActive(true); stepLimit = 80; steptext.text = M.stepCount.ToString() + "/" + stepLimit.ToString() + "Steps"; if (stepLimit <= M.stepCount) { M.playerReset(); } if (t1.touch == true && t2.touch == true && t3.touch == true && t4.touch == true) { doorOpenInCurrentLoop = true; } } if (loopCount == 5) { if (AudiSou.volume <= 0.1) { if (!c3p) { c3p = true; Debug.Log("Swapping Tracks"); AudiSou.clip = c3; AudiSou.Play(); } } else if (c2 == AudiSou.clip) { fadeOut(c2, AudiSou, c3); } if (c3p) { fadeIn(AudiSou); } stepObject.SetActive(true); stepLimit = 80; steptext.text = M.stepCount.ToString() + "/" + stepLimit.ToString() + "Steps"; li1.SetActive(true); li2.SetActive(true); if (stepLimit <= M.stepCount) { M.playerReset(); } if (M.stepCount % 2 == 0) { L1.SetActive(true); L2.SetActive(true); } else { L1.SetActive(false); L2.SetActive(false); } if (t1.touch == true && t2.touch == true && t3.touch == true && t4.touch == true) { doorOpenInCurrentLoop = true; } } if (loopCount == 6) { stepObject.SetActive(true); sb1.gameObject.SetActive(true); sb2.gameObject.SetActive(true); sb3.gameObject.SetActive(true); sb4.gameObject.SetActive(true); stepLimit = 80; steptext.text = M.stepCount.ToString() + "/" + stepLimit.ToString() + "Steps"; if (stepLimit <= M.stepCount) { M.playerReset(); } if (M.stepCount % 2 == 0) { L1.SetActive(true); L2.SetActive(true); } else { L1.SetActive(false); L2.SetActive(false); } if (t1.touch == true && t2.touch == true && t3.touch == true && t4.touch == true) { doorOpenInCurrentLoop = true; } } if (loopCount == 7) { if (AudiSou.volume <= 0.1) { if (!c4p) { c4p = true; Debug.Log("Swapping Tracks"); AudiSou.clip = c4; AudiSou.Play(); } } else if (c3 == AudiSou.clip) { fadeOut(c3, AudiSou, c4); } if (c4p) { fadeIn(AudiSou); } li3.SetActive(true); li4.SetActive(true); stepLimit = 80; steptext.text = M.stepCount.ToString() + "/" + stepLimit.ToString() + "Steps"; if (stepLimit <= M.stepCount) { M.playerReset(); } if (M.stepCount % 2 == 0) { L1.SetActive(true); L2.SetActive(true); } else { L1.SetActive(false); L2.SetActive(false); } if (M.stepCount % 4 == 0) { L3.SetActive(true); L4.SetActive(true); } else { L3.SetActive(false); L4.SetActive(false); } if (t1.touch == true && t2.touch == true && t3.touch == true && t4.touch == true) { doorOpenInCurrentLoop = true; } } if (loopCount == 8) { if (AudiSou.volume <= 0.1) { if (!c5p) { c5p = true; Debug.Log("Swapping Tracks"); AudiSou.clip = c5; AudiSou.Play(); } } else if (c4 == AudiSou.clip) { fadeOut(c4, AudiSou, c5); } if (c5p) { fadeIn(AudiSou); } sb5.gameObject.SetActive(true); sb6.gameObject.SetActive(true); stepLimit = 80; steptext.text = M.stepCount.ToString() + "/" + stepLimit.ToString() + "Steps"; if (stepLimit <= M.stepCount) { M.playerReset(); } if (M.stepCount % 2 == 0) { L1.SetActive(true); L2.SetActive(true); } else { L1.SetActive(false); L2.SetActive(false); } if (M.stepCount % 4 == 0) { L3.SetActive(true); L4.SetActive(true); } else { L3.SetActive(false); L4.SetActive(false); } if (t1.touch == true && t2.touch == true && t3.touch == true && t4.touch == true) { doorOpenInCurrentLoop = true; } } if (loopCount == 9) { if (AudiSou.volume <= 0.1) { if (!c6p) { c6p = true; Debug.Log("Swapping Tracks"); AudiSou.clip = c6; AudiSou.Play(); } } else if (c5 == AudiSou.clip) { fadeOut(c5, AudiSou, c6); } if (c6p) { fadeIn(AudiSou); } t1.gameObject.SetActive(true); t2.gameObject.SetActive(true); t3.gameObject.SetActive(true); t4.gameObject.SetActive(true); stepObject.SetActive(true); sb1.gameObject.SetActive(true); sb2.gameObject.SetActive(true); sb3.gameObject.SetActive(true); sb4.gameObject.SetActive(true); sb5.gameObject.SetActive(true); sb6.gameObject.SetActive(true); ES.gameObject.SetActive(true); stepLimit = 80; steptext.text = M.stepCount.ToString() + "/" + stepLimit.ToString() + "Steps"; if (stepLimit <= M.stepCount) { M.playerReset(); } if (M.stepCount % 2 == 0) { L1.SetActive(true); L2.SetActive(true); } else { L1.SetActive(false); L2.SetActive(false); } if (M.stepCount % 4 == 0) { L3.SetActive(true); L4.SetActive(true); } else { L3.SetActive(false); L4.SetActive(false); } if (t1.touch == true && t2.touch == true && t3.touch == true && t4.touch == true) { doorOpenInCurrentLoop = true; } } if (loopCount == 10) { if (AudiSou.volume <= 0.1) { if (!c7p) { c7p = true; Debug.Log("Swapping Tracks"); AudiSou.clip = c7; AudiSou.Play(); } } else if (c6 == AudiSou.clip) { fadeOut(c6, AudiSou, c7); } if (c7p) { fadeIn(AudiSou); } t1.gameObject.SetActive(true); t2.gameObject.SetActive(true); t3.gameObject.SetActive(true); t4.gameObject.SetActive(true); stepObject.SetActive(true); sb1.gameObject.SetActive(true); sb2.gameObject.SetActive(true); sb3.gameObject.SetActive(true); sb4.gameObject.SetActive(true); sb5.gameObject.SetActive(true); sb6.gameObject.SetActive(true); ES.gameObject.SetActive(true); ES2.gameObject.SetActive(true); stepLimit = 80; steptext.text = M.stepCount.ToString() + "/" + stepLimit.ToString() + "Steps"; if (stepLimit <= M.stepCount) { M.playerReset(); } if (M.stepCount % 2 == 0) { L1.SetActive(true); L2.SetActive(true); } else { L1.SetActive(false); L2.SetActive(false); } if (M.stepCount % 4 == 0) { L3.SetActive(true); L4.SetActive(true); } else { L3.SetActive(false); L4.SetActive(false); } if (t1.touch == true && t2.touch == true && t3.touch == true && t4.touch == true) { doorOpenInCurrentLoop = true; } } if (loopCount == 11) { if (AudiSou.volume <= 0.1) { if (!c8p) { c8p = true; Debug.Log("Swapping Tracks"); AudiSou.clip = c8; AudiSou.Play(); } } else if (c7 == AudiSou.clip) { fadeOut(c7, AudiSou, c8); } if (c8p) { fadeIn(AudiSou); } if (M.stepCount >= 1) { currentTime -= Time.deltaTime; timerText.text = "Time Remaining: " + currentTime; if (currentTime <= 0) { resetLoop(); } } t1.gameObject.SetActive(true); t2.gameObject.SetActive(true); t3.gameObject.SetActive(true); t4.gameObject.SetActive(true); stepObject.SetActive(true); sb1.gameObject.SetActive(true); sb2.gameObject.SetActive(true); sb3.gameObject.SetActive(true); sb4.gameObject.SetActive(true); sb5.gameObject.SetActive(true); sb6.gameObject.SetActive(true); ES.gameObject.SetActive(true); ES2.gameObject.SetActive(true); timerObject.SetActive(true); stepLimit = 80; steptext.text = M.stepCount.ToString() + "/" + stepLimit.ToString() + "Steps"; if (stepLimit <= M.stepCount) { M.playerReset(); } if (M.stepCount % 2 == 0) { L1.SetActive(true); L2.SetActive(true); } else { L1.SetActive(false); L2.SetActive(false); } if (M.stepCount % 4 == 0) { L3.SetActive(true); L4.SetActive(true); } else { L3.SetActive(false); L4.SetActive(false); } if (t1.touch == true && t2.touch == true && t3.touch == true && t4.touch == true) { doorOpenInCurrentLoop = true; } } if (loopCount == 12) { if (AudiSou.volume <= 0.1) { if (!c9p) { c9p = true; Debug.Log("Swapping Tracks"); AudiSou.clip = c9; AudiSou.Play(); } } else if (c8 == AudiSou.clip) { fadeOut(c8, AudiSou, c9); } if (c9p) { fadeIn(AudiSou); } SceneManager.LoadScene(2); } }
// Update is called once per frame void Update() { NowCursorState = tmpCursor.GetComponent <AnimatedCursor>().tmpCursorState; PlaceBtnState = PlaceButton.GetComponent <ButtonInteraction>().NowButtonState; DeleteBtnState = DeleteButton.GetComponent <ButtonInteraction>().NowButtonState; CancelBtnState = CancelButton.GetComponent <ButtonInteraction>().NowButtonState; lineRenderer = GetComponent <LineRenderer>(); //Debug.Log("Cursor Position: " + tmpCursor.transform.position); //Vector3 CursorPosition = tmpCursor.GetComponent<Transform>().position; if ((ButtonInteraction.PosState == PosButtonType.PLACE) && (NowCursorState == CursorStateEnum.Release) && (PlaceBtnState != ButtonStateEnum.Targeted) && (PlaceBtnState != ButtonStateEnum.Pressed) && (DeleteBtnState != ButtonStateEnum.Observation) && (CancelBtnState != ButtonStateEnum.Observation)) { if (SizeButtonCollection.SizeButtonState == SizeButtonType.MEDIUM) { offset = 6.0f; } else if (SizeButtonCollection.SizeButtonState == SizeButtonType.LARGE) { offset = 8.0f; } else if (SizeButtonCollection.SizeButtonState == SizeButtonType.SMALL) { offset = 5.0f; } Vector3 FinalPos = tmpCursor.transform.position - new Vector3(0f, 0f, 0.1f) * offset; Instantiate(PlaneObject, FinalPos, transform.rotation, this.transform); //Genarate the drone ChildCount = this.transform.childCount; /*Use to process the three Red Light*/ if (ChildCount > 1) { Vector3 pos1, pos2; //the position of two way point(drone) Vector3 p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18; //Red light initial position pos1 = this.gameObject.transform.GetChild(ChildCount - 2).transform.position; pos2 = this.gameObject.transform.GetChild(ChildCount - 1).transform.position; p0 = (pos1 * 1 + pos2 * 19) / 20; p1 = (pos1 * 2 + pos2 * 18) / 20; p2 = (pos1 * 3 + pos2 * 17) / 20; p3 = (pos1 * 4 + pos2 * 16) / 20; p4 = (pos1 * 5 + pos2 * 15) / 20; p5 = (pos1 * 6 + pos2 * 14) / 20; p6 = (pos1 * 7 + pos2 * 13) / 20; p7 = (pos1 * 8 + pos2 * 12) / 20; p8 = (pos1 * 9 + pos2 * 11) / 20; p9 = (pos1 * 10 + pos2 * 10) / 20; p10 = (pos1 * 11 + pos2 * 9) / 20; p11 = (pos1 * 12 + pos2 * 8) / 20; p12 = (pos1 * 13 + pos2 * 7) / 20; p13 = (pos1 * 14 + pos2 * 6) / 20; p14 = (pos1 * 15 + pos2 * 5) / 20; p15 = (pos1 * 16 + pos2 * 4) / 20; p16 = (pos1 * 17 + pos2 * 3) / 20; p17 = (pos1 * 18 + pos2 * 2) / 20; p18 = (pos1 * 19 + pos2 * 1) / 20; L0 = Instantiate(CloneRedLight_0, p0, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L0.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L0.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L0.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L1 = Instantiate(CloneRedLight_1, p1, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L1.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L1.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L1.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L2 = Instantiate(CloneRedLight_2, p2, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L2.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L2.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L2.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L3 = Instantiate(CloneRedLight_3, p3, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L3.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L3.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L3.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L4 = Instantiate(CloneRedLight_4, p4, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L4.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L4.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L4.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L5 = Instantiate(CloneRedLight_5, p5, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L5.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L5.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L5.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L6 = Instantiate(CloneRedLight_6, p6, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L6.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L6.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L6.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L7 = Instantiate(CloneRedLight_7, p7, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L7.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L7.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L7.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L8 = Instantiate(CloneRedLight_8, p8, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L8.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L8.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L8.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L9 = Instantiate(CloneRedLight_9, p9, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L9.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L9.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L9.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L10 = Instantiate(CloneRedLight_10, p10, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L10.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L10.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L10.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L11 = Instantiate(CloneRedLight_11, p11, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L11.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L11.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L11.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L12 = Instantiate(CloneRedLight_12, p12, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L12.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L12.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L12.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L13 = Instantiate(CloneRedLight_13, p13, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L13.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L13.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L13.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L14 = Instantiate(CloneRedLight_14, p14, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L14.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L14.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L14.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; ///////////////////////////////////////// L15 = Instantiate(CloneRedLight_15, p15, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L15.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L15.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L15.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L16 = Instantiate(CloneRedLight_16, p16, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L16.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L16.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L16.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L17 = Instantiate(CloneRedLight_17, p17, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L17.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L17.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L17.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; L18 = Instantiate(CloneRedLight_18, p18, this.gameObject.transform.GetChild(ChildCount - 2).transform.rotation, LightManager.transform); L18.GetComponent <RedLightPos>().Obj1 = this.gameObject.transform.GetChild(ChildCount - 2).gameObject; L18.GetComponent <RedLightPos>().Obj2 = this.gameObject.transform.GetChild(ChildCount - 1).gameObject; L18.GetComponent <RedLightPos>().Current_Num = ChildCount - 2; } //WayPoint.Add(tmp); //Debug.Log("InstantiateInstantiateInstantiateInstantiateInstantiateInstantiate"); } /* Line Process*/ ChildCount = this.transform.childCount; lineRenderer.SetVertexCount(ChildCount); if (ChildCount > 1) { for (int i = 0; i < ChildCount; i++) { tmp = this.gameObject.transform.GetChild(i).gameObject; lineRenderer.SetPosition(i, tmp.transform.position); } /*Obstacle Detect*/ for (int i = 0; i < ChildCount - 1; i++) { Obj1 = this.gameObject.transform.GetChild(i).gameObject; Obj2 = this.gameObject.transform.GetChild(i + 1).gameObject; Ray ray = new Ray(Obj1.transform.position, Obj2.transform.position - Obj1.transform.position); RaycastHit hit; //Debug.Log( i + " -> " + (i+1) + " distance : " + Vector3.Distance(Obj1.transform.position, Obj2.transform.position)); float distance = Vector3.Distance(Obj1.transform.position, Obj2.transform.position) - 0.1f; Physics.Raycast(ray, out hit, distance, mask); //When collision is NOT NULL, there is obstacles if (hit.transform != null) { lineRenderer.material = LineMat2; // if collision the line become red //Debug.Log("BBBBBBBBB"); //LineCollision = false; // Let Other Script Know Collision State //LineCollisionNum = i + 1; Debug.Log("Blocked by : " + hit.transform.name); } //If is NULL -> No Obstacles else if (hit.transform == null) { lineRenderer.material = LineMat1; //LineCollision = true; //LineCollisionNum = -1; //Debug.Log("NNNNNNNNN"); } //Debug.Log("Line color : " + lineRenderer.material); } } //if(ChildCount == 2) lineRenderer.SetPosition(2, new Vector3(0,0,1)); }