コード例 #1
0
        public void AddProbability(float probability, object data)
        {
            ProbabilityConfigItem item = new ProbabilityConfigItem();

            item.probability = probability;
            item.data        = data;
            m_ConfigTable.Add(item);
            m_Dirty = true;
        }
コード例 #2
0
        public List <object> GetMultiResult()
        {
            ProbabilityConfigItem item = null;

            List <object> result = new List <object>();

            for (int i = 0; i < m_ConfigTable.Count; ++i)
            {
                float rand = Random(m_BaseProbability);
                item = m_ConfigTable[i];

                if (rand <= item.probability)
                {
                    //命中
                    result.Add(item.data);
                }
            }

            return(result);
        }