public LightsInModel(Point coordinate, bool stateOn, int radius) { Light = new Lights(coordinate, stateOn, radius); Links = new int[GameModel.FormFactor]; Wires = new List <Wires>(); Involvement = false; }
public static void DrawLight(PaintEventArgs e, Lights light) { var radius = light.Radius; GraphicsPath path = new GraphicsPath(); path.AddEllipse(light.Coordinate.X - radius, light.Coordinate.Y - radius, 2 * radius, 2 * radius); PathGradientBrush pthGrBrush = new PathGradientBrush(path); if (light.StateOn) { pthGrBrush.CenterColor = Color.FromArgb(255, 255, 0, 0); } else { pthGrBrush.CenterColor = Color.FromArgb(255, 183, 180, 170); } Color[] colors = { Color.FromArgb(240, 0, 0, 0) }; pthGrBrush.SurroundColors = colors; pthGrBrush.FocusScales = new PointF(0.2f, 0.2f); e.Graphics.FillEllipse(pthGrBrush, light.Coordinate.X - radius, light.Coordinate.Y - radius, 2 * radius, 2 * radius); Pen blackPen = new Pen(Color.Black, 3); e.Graphics.DrawEllipse(blackPen, light.Coordinate.X - radius, light.Coordinate.Y - radius, 2 * radius, 2 * radius); }
private bool DetectionHitCircle(Lights light, int x, int y) { var dx = x - light.Coordinate.X; var dy = y - light.Coordinate.Y; var partWireToClick = 2.0 / 3; var rad = partWireToClick * Game.Param.Length; return((dx * dx + dy * dy) <= (rad * rad)); }