コード例 #1
0
 void prepare()
 {
     mGroupsHaveDepth = false;
     m_RepeatingGroups.MakePositive();
     m_RepeatingGroups.Clamp(0, GroupCount - 1);
     // Groups
     if (mGroupBag == null)
     {
         mGroupBag = new WeightedRandom <int>();
     }
     else
     {
         mGroupBag.Clear();
     }
     if (RepeatingOrder == CurvyRepeatingOrderEnum.Random)
     {
         for (int g = FirstRepeating; g <= LastRepeating; g++)
         {
             mGroupBag.Add(g, (int)(Groups[g].Weight * 10));
         }
     }
     // Prepare Groups & ItemBags
     for (int g = 0; g < Groups.Count; g++)
     {
         Groups[g].PrepareINTERNAL();
         mGroupsHaveDepth = mGroupsHaveDepth || (getMinGroupDepth(Groups[g]) > 0);
     }
 }
コード例 #2
0
 internal void PrepareINTERNAL()
 {
     m_RepeatingItems.MakePositive();
     m_RepeatingItems.Clamp(0, ItemCount - 1);
     if (mItemBag == null)
     {
         mItemBag = new WeightedRandom <int>();
     }
     else
     {
         mItemBag.Clear();
     }
     if (Items.Count == 0)
     {
         return;
     }
     if (RepeatingOrder == CurvyRepeatingOrderEnum.Random)
     {
         for (int i = FirstRepeating; i <= LastRepeating; i++)
         {
             mItemBag.Add(i, (int)(Items[i].Weight * 10));
         }
     }
 }