diff --git a/.vs/slots/v17/.suo b/.vs/slots/v17/.suo index dd57171..6c2c874 100644 Binary files a/.vs/slots/v17/.suo and b/.vs/slots/v17/.suo differ diff --git a/OptionPicker.cs b/OptionPicker.cs new file mode 100644 index 0000000..6c4ccc8 --- /dev/null +++ b/OptionPicker.cs @@ -0,0 +1,40 @@ +using Godot; +using System; + +public partial class OptionPicker : Node2D +{ + // Called when the node enters the scene tree for the first time. + public override void _Ready() + { + } + + // Called every frame. 'delta' is the elapsed time since the previous frame. + public override void _Process(double delta) + { + } + + public void Reset() + { + foreach (Node child in GetChildren()) + { + if (child is SlotSymbol slotSymbol) + { + slotSymbol.SetToRandom(); + } + } + } + + public void Show(bool visible) + { + foreach (CanvasItem child in GetChildren()) + { + child.Visible = visible; + } + } + + public SlotSymbol Select(int index) + { + Show(false); + return GetChildren()[index] as SlotSymbol; + } +} diff --git a/SlotMachine.cs b/SlotMachine.cs index 813ffc8..1ac05ce 100644 --- a/SlotMachine.cs +++ b/SlotMachine.cs @@ -2,6 +2,7 @@ using Godot; using Godot.NativeInterop; using System; using System.Collections.Generic; +using System.Numerics; public partial class SlotMachine : Sprite2D { @@ -40,7 +41,9 @@ public partial class SlotMachine : Sprite2D public override void _Ready() { Spins = 7; - } + GetOptionPicker().Show(false); + + } // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(double delta) @@ -68,22 +71,35 @@ public partial class SlotMachine : Sprite2D List slots = new List(); int points = 0; + bool x2 = false; + foreach (Wheel wheel in Wheels) { SlotSymbol newSlotSymbol = wheel.GetActiveSlotSymbol(); int matches = 0; + foreach (SlotSymbol otherSlot in slots) { - if (otherSlot.SlotType == newSlotSymbol.SlotType) + if (otherSlot.SlotType == newSlotSymbol.SlotType && newSlotSymbol.SlotType != SlotSymbol.Type.SPIN && newSlotSymbol.SlotType != SlotSymbol.Type.X2) { matches++; } + } - if (newSlotSymbol.SlotType == SlotSymbol.Type.SEVEN) - { - points += 7; - } + + if (newSlotSymbol.SlotType == SlotSymbol.Type.SEVEN) + { + points += 7; + } + else if (newSlotSymbol.SlotType == SlotSymbol.Type.SPIN) + { + Spins++; + } + else if (newSlotSymbol.SlotType == SlotSymbol.Type.X2) + { + x2 = true; } + slots.Add(newSlotSymbol); if (matches == 1) { @@ -93,11 +109,22 @@ public partial class SlotMachine : Sprite2D { points += 400; } - + } + + if (x2) + { + points *= 2; } GetNode