IEnumerator cooltime(hole h) { if (h == hole.blackhole) { isblockcool = false; blackCooltime.value = 0; while (blackCooltime.value != 2) { blackCooltime.value = Mathf.Clamp(blackCooltime.value + Time.smoothDeltaTime, 0, 2); yield return(null); } isblockcool = true; } else if (h == hole.whitehole) { iswhitecool = false; whiteCooltime.value = 0; while (whiteCooltime.value != 2) { whiteCooltime.value = Mathf.Clamp(whiteCooltime.value + Time.smoothDeltaTime, 0, 2); yield return(null); } iswhitecool = true; } }
private void button1_Click(object sender, EventArgs e) { holecount++; if (holecount < numericUpDown1.Value) { hole h = new hole(); h.addhole(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text)); textBox1.Text = ""; textBox2.Text = ""; h.holenumber = holecount; holes.AddLast(h); if (h.holeStartAddress >= END) { END = h.holeStartAddress + h.size; } if (h.holeStartAddress < START) { START = h.holeStartAddress; } } if (holecount == numericUpDown1.Value) { hole h = new hole(); h.addhole(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text)); h.holenumber = holecount; holes.AddLast(h); if (h.holeStartAddress >= END) { END = h.holeStartAddress + h.size; } if (h.holeStartAddress < START) { START = h.holeStartAddress; } label1.Visible = false; label3.Visible = false; label4.Visible = false; label8.Visible = false; numericUpDown1.Visible = false; textBox1.Visible = false; textBox2.Visible = false; button1.Visible = false; label2.Visible = true; label5.Visible = true; label6.Visible = true; numericUpDown2.Visible = true; textBox3.Visible = true; textBox4.Visible = true; button2.Visible = true; label9.Visible = true; } }
public void SetTeam(hole p_teamHole) { if (HatMesh != null) { Material HatMaterial = new Material(HatMesh.material); HatMaterial.SetColor("_EmissionColor", p_teamHole.teamColor); HatMesh.material = HatMaterial; } }
public void SetHole(HoleType type, Vector2 pos) { if ((HoleType)type == HoleType.Door) { this.Hole = new door(wallNum, pos.x); } else if ((HoleType)type == HoleType.Windows) { this.Hole = new windows(wallNum, pos); } }
public void resetAll() { Destroy(hasBlackhole); Destroy(hasWhitehole); isblockcool = true; iswhitecool = true; blackCooltime.value = 2; whiteCooltime.value = 2; Time.timeScale = 1f; hasClicked = hole.None; }
public void Awake() { for (int x = 0; x < 4; x++) { holes[x] = new hole(); } sPlusPosXBtn.clickCallBack = sPlusPosX; sMinusPosXBtn.clickCallBack = sMinusPosX; bPlusPosXBtn.clickCallBack = bPlusPosX; bMinusPosXBtn.clickCallBack = bMinusPosX; sPlusPosYBtn.clickCallBack = sPlusPosY; sMinusPosYBtn.clickCallBack = sMinusPosY; bPlusPosYBtn.clickCallBack = bPlusPosY; bMinusPosYBtn.clickCallBack = bMinusPosY; sPlusScaleXBtn.clickCallBack = sPlusScaleX; sMinusScaleXBtn.clickCallBack = sMinusScaleX; bPlusScaleXBtn.clickCallBack = bPlusScaleX; bMinusScaleXBtn.clickCallBack = bMinusScaleX; sPlusScaleYBtn.clickCallBack = sPlusScaleY; sMinusScaleYBtn.clickCallBack = sMinusScaleY; bPlusScaleYBtn.clickCallBack = bPlusScaleY; bMinusScaleYBtn.clickCallBack = bMinusScaleY; Wall0.clickCallBack = ChanegWall0; Wall1.clickCallBack = ChanegWall1; Wall2.clickCallBack = ChanegWall2; Wall3.clickCallBack = ChanegWall3; changeBuildInfo.clickCallBack = ChangeBuildInfo; changeType.clickCallBack = ChangeType; changeBool.clickCallBack = ChangeExist; sPlusWallX.clickCallBack = sPlusHolePosX; sMinusWallX.clickCallBack = sMinusHolePosX; bPlusWallX.clickCallBack = bPlusHolePosX; bMinusWallX.clickCallBack = bMinusHolePosX; sPlusWallY.clickCallBack = sPlusHolePosY; sMinusWallY.clickCallBack = sMinusHolePosY; bPlusWallY.clickCallBack = bPlusHolePosY; bMinusWallY.clickCallBack = bMinusHolePosY; }
void Check(hole p_hole) { if (p_hole.newcolor == target) { // Debug.Log(p_hole.team._id); // p_hole.fraction += 1; Debug.Log("p_hole.team, 1"); if (p_hole.team != null) { teamDroperManager.AddScore(p_hole.team, 1); } // Changed(); if (p_hole.fraction >= Maxfraction) { vt.Invoke(); } } }
private void compactMemory() { int pc = processes.Count(), accumilatedAddresses = 0; for (int i = 0, prevProcessEndAddress = 0, processSize = 0; i < pc; i++) { prevProcessEndAddress = processes[i].endAddress; processSize = processes[i].endAddress - processes[i].startAddress; process tempP = new process(); tempP.name = processes[i].name; tempP.startAddress = accumilatedAddresses; tempP.endAddress = accumilatedAddresses + processSize; processes[i] = tempP; accumilatedAddresses = processes[i].endAddress; } holes = new List <hole>(); hole tempH = new hole(); tempH.startAddress = accumilatedAddresses; tempH.endAddress = memory_size; holes.Add(tempH); draw(); return; }
public void wall() { Hole = new hole(); }
internal HoleDTO(hole hole) { Number = hole.number; Par = hole.par; }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Alpha1) && OnBlackhole) { if (hasBlackhole == null && Time.timeScale == 1 && isblockcool) { Time.timeScale = timeDelay; if (hasMaxBoundary == null) { hasMaxBoundary = Instantiate(boundary, this.transform); // hasMinBoundary = Instantiate(boundary, this.transform); hasMaxBoundary.transform.localScale = new Vector2(4 * maxRange, 4 * maxRange); // hasMinBoundary.transform.localScale = new Vector2(4 * minRange, 4 * minRange); } hasClicked = hole.blackhole; delayCorou = StartCoroutine(Delay()); } else if (hasBlackhole != null) { Destroy(hasBlackhole); StartCoroutine(cooltime(hole.blackhole)); } } if (Input.GetKeyDown(KeyCode.Alpha2) && OnWhitehole) { if (hasWhitehole == null && Time.timeScale == 1 && iswhitecool) { Time.timeScale = timeDelay; if (hasMaxBoundary == null) { hasMaxBoundary = Instantiate(boundary, this.transform); hasMinBoundary = Instantiate(boundary, this.transform); hasMaxBoundary.transform.localScale = new Vector2(4 * maxRange, 4 * maxRange); hasMinBoundary.transform.localScale = new Vector2(4 * minRange, 4 * minRange); } hasClicked = hole.whitehole; delayCorou = StartCoroutine(Delay()); } else if (hasWhitehole != null) { Destroy(hasWhitehole); StartCoroutine(cooltime(hole.whitehole)); } } if (Input.GetMouseButton(0) && Time.timeScale == timeDelay) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Vector3 rayDir = new Vector3(ray.origin.x, ray.origin.y); float distance = Vector3.Distance(rayDir, this.transform.position); if (hasClicked == hole.blackhole && maxRange > distance) { hasBlackhole = Instantiate(Blackhole, rayDir, transform.rotation); } else if (hasClicked == hole.whitehole && maxRange > distance && minRange < distance) { hasWhitehole = Instantiate(Whitehole, rayDir, transform.rotation); } StopCoroutine(delayCorou); Time.timeScale = 1; Destroy(hasMaxBoundary); Destroy(hasMinBoundary); } }
public List <hole> func(List <process> p, List <hole> h) { hole.sort_by_start(h); List <hole> final_memory = new List <hole>(); List <hole> empty_holes = new List <hole>(); empty_holes = h; int no_of_holes = h.Count; hole m; int k = 0; int size = 0; int j; int x; int[] counter = new int[no_of_holes]; for (int i = 0; i < no_of_holes; i++) { counter[i] = 0; } int total_sgements = 0; for (int i = 0; i < p.Count; i++) { total_sgements = p[i].no_of_segments + total_sgements; } Compaction_Before(empty_holes, ref no_of_holes); for (int i = 0; i < p.Count; i++) { List <hole> temperory_memory = new List <hole>(); // for segments of each process for (x = 0; x < p[i].no_of_segments; x++) { List <hole> best_holes = new List <hole>(); for (j = 0; j < no_of_holes; j++) { if (!empty_holes[j].alocated) { if (p[i].segment_sizes[x] <= empty_holes[j].size) { size = h[j].size - p[i].segment_sizes[x]; k++; m = new hole(h[j].start, size); m.hole_id = h[j].hole_id; best_holes.Add(m); if (k > 1) { hole.sort_by_size(best_holes); } } } } if (k != 0) { if (best_holes[0].size == 0) { empty_holes[best_holes[0].hole_id].alocated = true; empty_holes[best_holes[0].hole_id].name = p[i].name_of_segment[x]; temperory_memory.Add(h[best_holes[0].hole_id]); } else { int a = best_holes[0].start; int b = p[i].segment_sizes[x]; hole t = new hole(a, b); t.alocated = true; t.name = p[i].name_of_segment[x]; temperory_memory.Add(t); // second hole after splitting int z = t.start + t.size; int y = best_holes[0].size; hole s = new hole(z, y); s.hole_id = best_holes[0].hole_id; temperory_memory.Add(s); Compaction_After(empty_holes, best_holes, ref no_of_holes); hole.sort_by_start(empty_holes); } k = 0; } } int count = 0; for (int y = 0; y < temperory_memory.Count; y++) { for (int u = 0; u < p[i].no_of_segments; u++) { if (temperory_memory[y].name == p[i].name_of_segment[u]) { count++; if (count == p[i].no_of_segments) { for (int q = 0; q < temperory_memory.Count; q++) { if (temperory_memory[q].name == "hole") { empty_holes[temperory_memory[q].hole_id].start = temperory_memory[q].start; empty_holes[temperory_memory[q].hole_id].size = temperory_memory[q].size; hole.sort_by_start(empty_holes); } else { final_memory.Add(temperory_memory[q]); for (int w = 0; w < empty_holes.Count; w++) { if (temperory_memory[q].start == empty_holes[w].start && temperory_memory[q].size == empty_holes[w].size) { empty_holes[w].process_index = p[i].process_id; } } } } } else if (y == temperory_memory.Count - 1) { remaining_processes.Add(p[i]); for (int q = 0; q < temperory_memory.Count; q++) { for (int w = 0; w < empty_holes.Count; w++) { if (temperory_memory[q].start == empty_holes[w].start && temperory_memory[q].size == empty_holes[w].size) { empty_holes[w].alocated = false; empty_holes[w].name = "hole"; hole.sort_by_start(empty_holes); } } } } } } } hole.sort_by_start(final_memory); } for (int i = 0; i < no_of_holes; i++) { if (!empty_holes[i].alocated) { final_memory.Add(empty_holes[i]); hole.sort_by_start(final_memory); } } return(final_memory); }