Пример #1
0
        /// <summary>
        /// Inserts a wheel to the wheel as a subslot, at the desired index.
        /// </summary>
        /// <param name="index">Insertion index</param>
        /// <param name="slot">Wheel to be added as a slot</param>
        /// <returns></returns>
        override public bool AddSlotAt(int index, WheelBase slot)
        {
            if (slot.Root == Root)
            {
                throw new Exceptions.SameWheelException(name, slot.name);
            }

            if (RootDistance + slot.Depth > DEPTH_MAX)
            {
                throw new Exceptions.MaxDepthReachedException(name, slot.name);
            }

            if (slot != null && ((Wheel)slot).SetParent(this))
            {
                ResetDepth();
                if (subslots.Count < index)
                {
                    subslots.Add(slot);
                }
                else
                {
                    subslots.Insert(index, slot);
                }

                UpdateTotal();
                return(true);
            }

            return(false);
        }
Пример #2
0
        public void Add(WheelBase slot, uint totalChance)
        {
            chosen.Add(slot);
            float singleChance = (float)slot.chance / totalChance;

            chance *= singleChance;
        }
Пример #3
0
        /// <summary>
        /// Adds a wheel to the subwheel at the given index as a subslot.
        /// </summary>
        /// <param name="index">Index of the subwheel</param>
        /// <param name="slot">Wheel to be added as a slot</param>
        /// <returns></returns>
        override public bool AddSubslot(int index, WheelBase slot)
        {
            if (index < subslots.Count)
            {
                depth = -1;
                return(subslots[index].AddSlot(slot));
            }

            return(false);
        }
Пример #4
0
        /// <summary>
        /// Adds a wheel to the subwheel at the given index as a subslot.
        /// </summary>
        /// <param name="slotName">Name of the subwheel<</param>
        /// <param name="slot"></param>
        /// <param name="slot">Wheel to be added as a slot</param>
        /// <returns></returns>
        override public bool AddSubslot(string slotName, WheelBase slot)
        {
            if (slot == null)
            {
                return(false);
            }

            foreach (WheelBase subslot in subslots)
            {
                if (subslot.name == slotName)
                {
                    depth = -1;
                    return(subslot.AddSlot(slot));
                }
            }

            return(false);
        }
Пример #5
0
 /// <summary>
 /// Adds a wheel to the wheel as a subslot.
 /// </summary>
 /// <param name="slot">Wheel to be added as a slot</param>
 /// <returns></returns>
 override public bool AddSlot(WheelBase slot)
 {
     return(AddSlotAt(subslots.Count, slot));
 }
Пример #6
0
 public abstract bool AddSubslot(string slotName, WheelBase slot);
Пример #7
0
 public abstract bool AddSubslot(int index, WheelBase slot);
Пример #8
0
 public abstract bool AddSlot(WheelBase slot);