Beispiel #1
0
        public WheelStopsList()
        {
            // make a node for each possible stop in the correct order
            foreach (VMEODSlotsStops stop in Enum.GetValues(typeof(VMEODSlotsStops)))
            {
                if (Previous != null)
                {
                    Current       = new WheelStopNode(stop);
                    Previous.Next = Current;
                }
                else
                {
                    Next = Current = new WheelStopNode(stop);
                }
                Previous = Current;
            }
            // close the loop by settings top-most's (the jackspot/sixth stop) Next to bottom-most, the first one made (blankOne)
            Current.Next = Next;

            // Previous is not used during gameplay, so setting it to be a BLANK stop will serve a purpose when the wheel stops
            Previous = Next;

            // begin stopped
            State = UISlotsEODSlotWheelStates.Stopped;
        }
Beispiel #2
0
        public void SlowDown()
        {
            TargetStopsAway = 0;
            var tempNode = new WheelStopNode(Current.MyStop, Current);

            while (!tempNode.Next.MyStop.Equals(TargetStop))
            {
                TargetStopsAway++;
                tempNode = tempNode.Next;
            }
            if (TargetStopsAway < 3) // TargetStop is too close to make animation fun
            {
                TargetStopsAway += 12;
            }
            // calculate distance away
            DistanceToTarget = ((TargetStopsAway * UISlotsEOD.WHEEL_TEXTURE_WIDTH_AND_HEIGHT) - MyOffsetY);
            State            = UISlotsEODSlotWheelStates.Slowing;
        }
Beispiel #3
0
        public void Spin()
        {
            switch (State)
            {
            case UISlotsEODSlotWheelStates.Stopped:
            {
                IsSpinFinished = true;
                break;
            }

            case UISlotsEODSlotWheelStates.Spinning:
            {
                MyOffsetY += CurrentSpeed;
                break;
            }

            case UISlotsEODSlotWheelStates.Starting:
            {
                if (CurrentSpeedCounter == 2)
                {
                    // if at the penultimate speed, skip to ultimate
                    if (CurrentSpeed == 22)
                    {
                        CurrentSpeed        = 29;
                        CurrentSpeedCounter = 0;
                        State = UISlotsEODSlotWheelStates.Spinning;
                    }
                    // increase the speed
                    else
                    {
                        CurrentSpeed       += UISlotsEOD.WHEEL_FRAME_CONSTANT;
                        CurrentSpeedCounter = 0;
                    }
                }
                MyOffsetY += CurrentSpeed;
                CurrentSpeedCounter++;
                break;
            }

            case UISlotsEODSlotWheelStates.Slowing:
            {
                // still move at full speak since target is far away
                if (DistanceToTarget > 116)
                {
                    CurrentSpeed = 29;
                }
                // start to slow down
                else if (DistanceToTarget == 116)
                {
                    CurrentSpeed        = 22;
                    CurrentSpeedCounter = 0;
                }
                // 0 > DistanceToTarget < 116
                else
                {
                    // check if this is first or second time at CurrentSpeed
                    if (CurrentSpeedCounter == 2)
                    {
                        // if Current speed is slowest, make it stop
                        if (CurrentSpeed == 7)
                        {
                            CurrentSpeed = 0;
                            if (TicksToStop > 5)         // stopped early
                            {
                                TicksToStop = 5;
                            }

                            MyOffsetY = LeftoverY = RandomLeftover.Next(0, TicksToStop);
                            State     = UISlotsEODSlotWheelStates.Stopping;
                        }
                        // otherwise, go even slower
                        else
                        {
                            CurrentSpeed       -= UISlotsEOD.WHEEL_FRAME_CONSTANT;
                            CurrentSpeedCounter = 0;
                        }
                    }
                }
                TicksToStop--;
                CurrentSpeedCounter++;
                DistanceToTarget -= CurrentSpeed;
                MyOffsetY        += CurrentSpeed;
                break;
            }

            case UISlotsEODSlotWheelStates.Stopping:
            {
                if ((TicksToStop == 0))
                {
                    MyOffsetY = LeftoverY = 0;
                    State     = UISlotsEODSlotWheelStates.Stopped;
                    break;
                }
                else if (TicksToStop % 2 == 1)
                {
                    MyOffsetY = LeftoverY = (LeftoverY / 2);
                }
                TicksToStop--;
                break;
            }
            }
            // checking if list needs to update
            if (MyOffsetY >= UISlotsEOD.WHEEL_TEXTURE_WIDTH_AND_HEIGHT)
            {
                MyOffsetY -= UISlotsEOD.WHEEL_TEXTURE_WIDTH_AND_HEIGHT;
                Previous   = Current;
                Current    = Next;
                Next       = Next.Next;
            }
        }
Beispiel #4
0
 public WheelStopNode(VMEODSlotsStops stop, WheelStopNode next)
 {
     MyStop = stop;
     Next   = next;
     CalculateStartingY();
 }