public void Update(List<Obstacle> Lob, DragObj Ldo) { bool inter = false; A = new Point((int)pos.X + 15, (int)pos.Y + 25); // for (int index = 0; index < Lob.Count(); index++) // { B = new Point((int)Ldo.Shape.Center.X, (int)Ldo.Shape.Center.Y); for (int j = 0; j < Lob.Count(); j++) // verif si elel est allume avec 1 station sinon relancer { if (inter = interclass.LineIntersectsRect(A, B, Lob[j].Shape)) // if (inter = interclass.LineIntersectsRect(RotatePoint(A, new Point(Lob[j].Shape.Center.X, Lob[j].Shape.Center.Y), Lob[j].rotation), RotatePoint(B, new Point(Lob[j].Shape.Center.X, Lob[j].Shape.Center.Y), Lob[j].rotation), Lob[j].Shape)) { inter = true; islight = false; break; } else { inter = false; } } if (inter == false) { // coments are there for multi dragobj if (islight == false) islight = true; //break; } //} }
public Vise(Vector2 A, Vector2 B, DragObj C, DragObj D) { stat1 = A; stat2 = B; st1 = C; st2 = D; colorvise = Color.Black; nice = false; }
public void AddToDragObjList(DragObj ToAdd) { ListDragObj.Add(ToAdd); }
// button trash public void rmone_station_list(DragObj sel) { if (sel.IsGps == false) { if (sel.isvise == true) { istake = false; } if (ListDragObj.Count() > 0) { // test en remove le break. // va savoir pourqoi sa bug sans le break // calculer le nombre de visé par station et en fonction de sa : // soit simple suppression, soit suppr toute les visées. foreach (Vise vs in ListVise) { if ((sel == vs.st1) || (sel == vs.st2)) { ListVise.Remove(vs); break; } } ListDragObj.Remove(sel); } } }
// gere le click sur les differents boutons public void Mouseclik(int x, int y) { Rectangle mouserec = new Rectangle(x, y, 10, 10); //Ester Egg geosat //if (mouserec.Intersects(ButtonPauseRect)) // { // if (PausePopUp) // PausePopUp = false; // else // PausePopUp = true; // } if (butaddrect.Intersects(mouserec)) { DragObj newone; newone = new DragObj(); newone.Initialize(textgps, new Vector2(320, 335), textgpssel, false); add_station_list(newone); } else if (addgpsrect.Intersects(mouserec)) { DragObj newone; if (counter < 2) { counter += 1; newone = new DragObj(); newone.Initialize(textstation, new Vector2(380, 335), textstationsel, true); add_station_list(newone); } } for (int i = 0; i < ListDragObj.Count(); i++) { if (ListDragObj[i].Shape.Intersects(btlessrect)) { rmone_station_list(ListDragObj[i]); } } }
public void add_station_list(DragObj justcreated) { // Limitation a 30 station pour le moment if (ListDragObj.Count() < 30) ListDragObj.Add(justcreated); }