public void LijnToevoegenAanRij(Lijn lijn) { _lijnen.Enqueue(lijn); }
public void MaakWaterskibaan() { Waterskibaan.Children.Clear(); Ellipse cirkel = new Ellipse { Fill = Brushes.Black, Width = 20, Height = 20, StrokeThickness = 2, Stroke = Brushes.Black }; Canvas.SetLeft(cirkel, 238); Canvas.SetTop(cirkel, 200); Waterskibaan.Children.Add(cirkel); int[,] positiesArray = new int[10, 2] { { 107, 200 }, { 147, 127 }, { 208, 83 }, { 275, 83 }, { 328, 127 }, { 363, 200 }, { 328, 283 }, { 275, 315 }, { 208, 315 }, { 147, 283 } }; int[,] labelArray = new int[10, 2] { { 89, 220 }, { 129, 152 }, { 190, 103 }, { 257, 108 }, { 310, 152 }, { 345, 225 }, { 310, 303 }, { 257, 335 }, { 190, 335 }, { 129, 303 } }; //pos0 = (89,220) width is elke keer 60 //pos1 = (129,152) //pos2 = (190,103) //pos3 = (257,108) //pos4 = (310,152) //pos5 = (345,225) //pos6 = (310,303) //pos7 = (257,335) //pos8 = (190,335) //pos9 = (129,303) for (int i = 0; i < 10; i++) { Random rnd = new Random(); try { if (game.wsb.kabel._lijnen.ElementAt(i) != null) { Lijn lijn = game.wsb.kabel._lijnen.ElementAt(i); Sporter sporter = lijn.SporterAanLijn; Color kledingColor = sporter.KledingKleur; SolidColorBrush kledingKleur = new SolidColorBrush(Color.FromRgb(kledingColor.R, kledingColor.G, kledingColor.B)); //position0 = (107,200) //position1 = (147,127) //position2 = (208,83) //position3 = (275,83) //position4 = (328,127) //position5 = (363,200) //position6 = (328,283) //position7 = (275,315) //position8 = (208,315) //position9 = (147,283) DrawSporter(kledingKleur, positiesArray[i, 0], positiesArray[i, 1], 20, Waterskibaan); DrawLine((positiesArray[i, 0] + 10), (positiesArray[i, 1] + 10)); string output = ""; output += $"{i} \n"; int randomResult = rnd.Next(1, 4); if (randomResult == 2 && i != 0) { Sporter obj = null; if (game.logger.alleBezoekers.Contains(sporter)) { obj = game.logger.alleBezoekers.FirstOrDefault(x => x == sporter); } output = ""; int punten = sporter.Move(); if (punten > 5) { if (obj != null) { game.logger.alleBezoekers.FirstOrDefault(x => x == sporter).behaaldePunten += punten; } sporter.behaaldePunten += punten; //Draai = 20 //EenBeen = 70 //EenHand = 30 //Jump = 40 if (punten == 20) { output += "Draai \n Success!"; } else if (punten == 30) { output += "Één hand \n Success!"; } else if (punten == 40) { output += "Jump \n Success!"; } else if (punten == 70) { output += "Één been \n Success!"; } else { output += "Uh oh"; } } else if (punten < 5) { if (punten == 1) { output += "Jump \n failed"; } else if (punten == 2) { output += "Draai \n failed"; } else if (punten == 3) { output += "Één been \n failed"; } else if (punten == 4) { output += "Één hand \n failed"; } } else { output += ""; } } DrawText(labelArray[i, 0], labelArray[i, 1], output); } } catch (ArgumentOutOfRangeException) { } } }