예제 #1
0
파일: Wheel.cs 프로젝트: rectdev/wheel
        /// <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
파일: RollResult.cs 프로젝트: rectdev/wheel
        public void Add(WheelBase slot, uint totalChance)
        {
            chosen.Add(slot);
            float singleChance = (float)slot.chance / totalChance;

            chance *= singleChance;
        }
예제 #3
0
파일: Wheel.cs 프로젝트: rectdev/wheel
        /// <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
파일: Wheel.cs 프로젝트: rectdev/wheel
        /// <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
파일: Wheel.cs 프로젝트: rectdev/wheel
 /// <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
파일: WheelBase.cs 프로젝트: rectdev/wheel
 public abstract bool AddSubslot(string slotName, WheelBase slot);
예제 #7
0
파일: WheelBase.cs 프로젝트: rectdev/wheel
 public abstract bool AddSubslot(int index, WheelBase slot);
예제 #8
0
파일: WheelBase.cs 프로젝트: rectdev/wheel
 public abstract bool AddSlot(WheelBase slot);