diff --git a/Financial_Freedom/Financial_Freedom/Financial_Freedom.cs b/Financial_Freedom/Financial_Freedom/Financial_Freedom.cs index 8d64df49630f80bb6d879ab0ac05df9865be8838..e6c43a0b3746bbeed2bb45bcde2c989d7ecc2fb7 100644 --- a/Financial_Freedom/Financial_Freedom/Financial_Freedom.cs +++ b/Financial_Freedom/Financial_Freedom/Financial_Freedom.cs @@ -1456,22 +1456,18 @@ public class Financial_Freedom : PhysicsGame while (!slotitPysaytetty) { - if (!slotitPysaytetty) + foreach (var slot in slots) { - foreach (var slot in slots) - { - - slot.Velocity = nopeus; - slot.Collided += (ptpl, stoppalkki) => - { - if (ptpl == slot && stoppalkki == stopper) - { - slot.Velocity = nopeus; - slot.Position = new Vector(slot.Position.X, Level.Top + 200); - slot.Image = slotImages[RandomGen.NextInt(0, slotImages.Length)]; - } - }; - } + slot.Velocity = nopeus; + slot.Collided += (ptpl, stoppalkki) => + { + if (ptpl == slot && stoppalkki == stopper && !slotitPysaytetty) + { + slot.Velocity = nopeus; + slot.Position = new Vector(slot.Position.X, Level.Top + 200); + slot.Image = slotImages[RandomGen.NextInt(0, slotImages.Length)]; + } + }; } Keyboard.Listen(Key.Space, ButtonState.Pressed, () => { @@ -1486,10 +1482,10 @@ public class Financial_Freedom : PhysicsGame slot.Stop(); slot.MakeStatic(); } + slotitPysaytetty = true; } }; }; - slotitPysaytetty = true; }, "pysäyttää slotit"); await Task.Delay(100); } @@ -1503,8 +1499,14 @@ public class Financial_Freedom : PhysicsGame TakaisinPV(); } + + /// <summary> + /// tarkistaa paljonko rahaa pitää antaa takaisin ja antaa sen + /// </summary> + public void TseggaaPisteet(PhysicsObject[,] slotsGrid, Image[] slotImages) { + int rivit = slotsGrid.GetLength(0); int kerrokset = slotsGrid.GetLength(1);