private void RotationWires(LightsInModel light, MouseEventArgs e) { for (int i = 0; i < light.Wires.Count; i++) { var direction = light.Wires[i].Direction; if (e.Button == MouseButtons.Left) { light.Wires[i].Direction = (direction + 1) % GameModel.FormFactor; } else { light.Wires[i].Direction = Math.Abs((direction + GameModel.FormFactor - 1)) % GameModel.FormFactor; } } }
private void CreateLights(int rank, int xCenter, int yCenter) { int count = FormFactor * CalcCountLights(rank) + 1; Lights = new LightsInModel[count]; int countRow = 1 + 2 * rank; int countInRow = countRow - rank; int delta = 2 * Param.Length; int yStart = yCenter - rank * delta; for (int i = 0, k = 0; i < countRow; i++) { int xStart = xCenter - (countInRow - 1) * Param.Length; for (int j = 0; j < countInRow; j++, k++) { Lights[k] = new LightsInModel(new Point(j * delta + xStart, i * delta + yStart), false, Param.Radius); Lights[k].DefinitionLinks(k, countInRow, i, countRow); } countInRow = i < countRow / 2 ? countInRow + 1 : countInRow - 1; } Lights[count / 2].Light.StateOn = true; }