示例#1
0
 // Start is called before the first frame update
 void Start()
 {
     for (int i = 0; i < m_NPCItemList.Count; ++i)
     {
         m_NPCItems.AddEntry(m_NPCItemList[i], m_NPCItemList[i].GetSetItemChance);
     }
 }
示例#2
0
    // Created a random chance "algorithm" based on this solution
    // https://gamedev.stackexchange.com/questions/162976/how-do-i-create-a-weighted-collection-and-then-pick-a-random-element-from-it

    // Start is called before the first frame update
    void Start()
    {
        // Prep the gameEvents list
        for (int i = 0; i < ListOfEvents.Count; ++i)
        {
            gameEvents.AddEntry(ListOfEvents[i], ListOfEvents[i].GetSetEventChance);
            //ListOfEvents[i].GetSetEventChance = 5;
        }
    }